How to detect if JavaScript is disabled?

Problem:

You have a website contains javascript. But the user of your site disables the javascript or the browser doesn’t work javascript properly. In this case, you need to give a warning to the user that “The site isn’t able to work properly without the browser Javascript enabled”.

Solution:

Write the following code between <body> and </body>
The code:

<noscript>The site isn’t able to work properly without the browser Javascript enabled!</noscript>

Explanation:
The contents inside the <noscript> tag will be displayed if the users disable or the browser doesn’t support javascript. If javascript is supported, that massage will not be displayed.
If the user disables javascript or browser doesn’t support it, user will get that warning massage.



Pin It

↑ Back to Top