Open In App

When to use <noscript> tag in HTML ?

Last Updated : 25 Aug, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

The <noscript> Tag in HTML is used to check whether the Browsers should support JavaScript or not. It is used to show the alternative text for those browsers which do not support script tag The <noscript> tag is used to handle the browsers, which do admit <script> tag but do not sustain scripting. This tag is placed in both <head> and <body> tag.

Syntax

<noscript> Contents... </noscript>

Example: Below HTML code illustrates the use of <noscript> Tag in HTML.

HTML




<!DOCTYPE html>
<html>
 
<body>
    <h1>GeeksforGeeks</h1>
 
    <h2>
        Checking whether the browser 
        supports javascript or not.
    </h2>
     
    <script>
        document.write("This browser supports javascript")
    </script>
     
    <!-- noscript tag starts -->
    <noscript>
        This Browser do not support Javasctipt
    </noscript>
    <!-- noscript tag ends -->
</body>
 
</html>


Explanation: The Browsers which do not support JavaScript will show the text inside the <noscript> tag, otherwise a message i.e. “This browser supports JavaScript” inside the <script> tag will appear on the HTML page.

Output:


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads