Open In App

How to find whether browser supports JavaScript or not ?

We will discuss how to find whether our Browser supports JavaScript or not. For this, we need to use the <noscript> tag, which defines an alternate text to be displayed to users who have disabled <script> tag in their Browsers. Since JavaScript is written inside <script> tag in HTML document, the JavaScript would not be supported by that browser that has disabled <script> tag.

The <noscript> tag can be used inside both <head> and <body> tags. If <noscript> tag is present inside the <head> then, <link>, <meta> and <style> tag could only be inserted inside <noscript> tag.



Syntax:

<noscript> content </noscript>

Example:






<!DOCTYPE html>
<html>
 
<body>
    <h1>Verify if browser supports JavaScript</h1>
     
<p>
      "GeeksforGeeks" will be displayed by
       browser if it supports JavaScript
    </p>
 
 
    <script>
        document.write("GeeksforGeeks");
    </script>
 
    <noscript>
        Sorry, JavaScript is not supported by your browser!
    </noscript>
</body>
 
</html>

Output: If JavaScript is supported.

Indicates that Browser supports JavaScript

Disable JavaScript in Google Chrome:

Refer the image for setting:

Now run the above HTML example code.

Output: If JavaScript is not supported,

 Indicates that Browser does not support JavaScript

Article Tags :