Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

HTML5 <noscript> tag


May 03, 2021 HTML5


Table of contents


The use of labels:

<script>
document.write("Hello World!")
</script>
<noscript>抱歉,你的浏览器不支持 JavaScript!</noscript>
Try it out . . .

Browser support

HTML5 <noscript> tag HTML5 <noscript> tag HTML5 <noscript> tag HTML5 <noscript> tag HTML5 <noscript> tag

Most browsers currently support the hashtag.


Label definition and instructions for use

The noscript element is used to define alternate content (text) when the script is not executed.

This tag can be used by browsers that can identify the hashtag but cannot support the scripts in it.


Tips and comments

Tip: If the browser supports the script, it does not display text in the noscript element.

Note: Browsers that do not recognize the label will display the contents of the label on the page. T o prevent the browser from doing so, you should hide the script in the comment label. Older browsers (which don't recognize the hashtag) ignore comments so that the contents of the tags are not written to the page, while new browsers know how to execute these scripts, even if they're surrounded by comment tags!

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

The difference between HTML 4.01 and HTML5

In HTML 4.01, the label is only allowed to be inserted into the element.

In HTML5, the labels can be inserted into the .lt;head> and slt;body?gt; regions.


The difference between HTML and XHTML

XHTML does not support the label.


Global properties

The label supports global properties and views the full property sheet HTML global properties.


Related articles

HTML tutorial: HTML script