English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
HTML <noscript> tag defines the alternative HTML to be inserted when the script type is not supported or the browser has disabled scripts. This tag is also commonly referred to as the <noscript> element.
<noscript> tag usage:
<!doctype html> <html> <head> <meta charset="UTF-8"> <title>HTML5 How to use <noscript> tag (Basic Tutorial Website oldtoolbag.com)</title> </head> <body> <h1>Heading 1</h1> <p>This is a paragraph that appears under Heading 1.<//p> <script src="/js/examples.js"></script> <script>document.write("Hello World!")</script> <noscript> <p>This is a <a href="examples.html">link to more examples</a>.</p> </noscript> <noscript>Sorry, your browser does not support JavaScript!</noscript>/noscript> </body> </html>Test it out ‹/›
IEFirefoxOperaChromeSafari
Most browsers currently support the <noscript> tag.
The noscript element is used to define alternative content (text) to be displayed when the script is not executed.
This tag can be used in browsers that can recognize the <noscript> tag but do not support the scripts within it.
If the script type is not supported or the browser has disabled scripts, the <noscript> tag will display alternative HTML content.
If scripts are enabled in the browser, the <noscript> tag will not display any content on the page.
See also <script> Tag.Tip:If the browser supports scripts, it will not display the text within the noscript element.
Comment:Browsers that do not recognize the <script> tag will display the content of the tag on the page. To prevent browsers from doing this, you should hide the script in comment tags. Older browsers that do not recognize the <script> tag will ignore comments, so the content of the tag will not be written to the page, while newer browsers will understand to execute these scripts, even if they are enclosed in comment tags!
<script>
<!--
function displayMsg()
{
alert("Hello World!")
}
//-->
</script>
In HTML 4.01 In, the <noscript> tag is allowed to be inserted only into the <body> element.
In HTML5 In, the <noscript> tag can be inserted into the <head> and <body> areas.
XHTML does not support the <noscript> tag.
<noscript> tag supports global attributes, see the complete attribute table HTML Global Attributes.
HTML Tutorial:HTML Script