Saturday, November 16, 2024
Google search engine
HomeLanguagesJavascriptHow to find whether browser supports JavaScript or not ?

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:

HTML




<!DOCTYPE html>
<html>
 
<body>
    <h1>Verify if browser supports JavaScript</h1>
     
<p>
      "neveropen" will be displayed by
       browser if it supports JavaScript
    </p>
 
 
    <script>
        document.write("neveropen");
    </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:

  • Click on the “Customize and control Google Chrome” and select “Settings”.
  • Under the “Privacy and security” click on the “Site Settings…”.
  • When the dialog window opens, look for the “JavaScript” section of “Content” topic and select “Don’t allow sites to use JavaScript”.
  • Close the “Settings” tab.
  • Reload this page  of the web browser to refresh the page.

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

Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!

RELATED ARTICLES

Most Popular

Recent Comments