Description
The HTML element <noscript>
is used to define alternate content to be displayed for the users using the browsers with any of the below conditions.
- Browsers that don't support client-side scripting or JavaScript
- Browsers that don't recognize the client-side scripts
- Browsers with scripts disabled
The contents of this element are displayed only when the user's browser doesn't support scripts due to any of the above conditions.
The below table summarizes its usage.
Usage Details | |
Placement | It is displayed as a Block element. It can be defined either in the <head> or <body> elements. |
Contents | It can contain Block elements, Inline elements, and text. If it is defined within the <head> elements, then it can only contain the <link> , <style> , and <meta> elements. |
Tags | Both the opening and closing tags are required. |
Versions | HTML 4, 4.01, 5 |
Syntax
Here is the basic syntax of the <noscript>
element.
<noscript>...</noscript>
Examples
<!DOCTYPE html>
<html lang="en">
<head>
<title>Example - HTML Element noscript</title>
</head>
<body>
<script type="text/javascript">
document.write("Hello World!")
</script>
<noscript>Oops, Your browser does not support JavaScript!</noscript>
</body>
</html>
Attributes
The following table shows the list of supported and unsupported attributes for the <noscript>
element.
Attribute Type | Details |
Element-Specific Attributes | The tag <noscript> doesn't have any element-specific attributes. |
Global Attributes | Like all other HTML tags, the tag <noscript> supports the HTML Global Attributes. |
Event Attributes | The tag <noscript> also supports the HTML Event Attributes. |
Browser Compatibility
The tag <noscript>
is supported in all modern browsers.
- Google Chrome 1+
- Internet Explorer or Edge 3+
- Firefox 1+
- Apple Safari 1+
- Opera 4+