Using the <noscript> tag

As you work with JavaScript, keep in mind that JavaScript is not supported by all browsers (i.e., by old browsers). There is a small percentage of browsers that are not JavaScript-compliant, however. Even if a browser does support JavaScript, a user may turn off running JavaScript. When a browser does not support JavaScript or JavaScript is disabled to run on the browser, your JavaScript code cannot be run. You may want to inform the user what your JavaScript code does so the user can enable JavaScript, if possible.

The <noscript> tag is the solution for providing information to users whenever JavaScript cannot be run on a particular browser. Note the <noscript> tag is ignored by those browsers that support JavaScript; the <script> tag, on the other hand, is ignored by those browsers that don't support JavaScript.

To use the <noscript>, simply place it after the closing </script> tag, as shown below:

<script language="JavaScript">
JavaScript code
</script>
<noscript>This page is trying to run JavaScript and your browser either does not support JavaScript or you may have turned-off JavaScript. If you have disabled JavaScript on your computer, please turn on JavaScript. Thank you</noscript>

Again, the code inside the <script> tag will be executed by those browsers that support and are enabled to run JavaScript. The code inside the <noscript> tag will be executed by those browsers that do not support JavaScript or when JavaScript is disabled.