HTML <noscript>Tag


Examples

Usage of the <noscript> tag:

<script> document.write("Hello World!") </script> <noscript>Sorry, your browser does not supportJavaScript!</noscript>

Try it Yourself »

Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

Most browsers currently support the <noscript> tag.



Definition and Usage

The noscript element is used to define alternative content (text) to be displayed when a script is not executed.

This tag can be used for browsers that recognize the <noscript> tag but cannot support scripts within it.



Tips and Notes

Tip:If a browser supports scripting, it will not display the text in the noscript element.

Note:Browsers that do not recognize the <script> tag will display the tag's content on the page. To prevent this, you should hide the script in comment tags. Old browsers (that cannot recognize <script> tags) will ignore the comments, so the tag's content will not be written to the page, while new browsers know how to execute these scripts even if they are surrounded by comment tags!

<script>
<!--
function displayMsg()
{
    alert("Hello World!")
}
//-->
</script>


Differences between HTML 4.01 and HTML5

In HTML 4.01, the <noscript> tag is only allowed to be inserted inside the <body> element.

In HTML5, the <noscript> tag can be inserted into both the <head> and <body> areas.



Differences between HTML and XHTML

XHTML does not support the <noscript> tag.



Global Attributes

The <noscript> tag supports global attributes. View the full attribute table.HTML Global Attributes。



Related Articles

HTML Tutorial:HTML Scripts

Other Extensions