Is JavaScript enabled | HTML Example code to Check

How to detect if JavaScript is disabled?

You can use <noscript> and <meta> tag to check JavaScript enabled. The noscript blocks are executed when JavaScript is disabled. It’s typically used to display alternative content to that you’ve generated in JavaScript,

Note: It’s not give 100% accurate result, There is not a good way to perform server-side JavaScript detection.

Example of Check If JavaScript Is Enabled

Here is worked code: it redirects a visitor if JavaScript is disabled, example in HTML.

Output: If JavaScript enabled then it will not redirect error webpage.

If you want a purely statistical idea of how many of your users have javascript disabled, you could do something like:

Do comment if you are facing any issue or have any suggestions on this tutorial.

Note: All JS Examples codes are tested on the Firefox browser and the Chrome browser.
OS: Windows 10
Code: HTML 5 Version


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.