HTML Tags
HTML <noscript> Tag
The <noscript> tag defines content to display when the browser has JavaScript disabled or does not support it. It provides a graceful fallback for scripted pages.
The <noscript> Tag
The <noscript> element holds content that is shown only when scripting is turned off or unavailable in the user's browser. When JavaScript is enabled, the browser ignores everything inside <noscript>.
It can appear in the <head> (where it may only contain link, style, and meta) or in the <body> (where it may contain any flow content such as paragraphs and images).
Syntax
<noscript>
<p>Fallback shown when JavaScript is off.</p>
</noscript>Example
<!DOCTYPE html>
<html>
<body>
<h1>Interactive Dashboard</h1>
<script>
document.write("<p>JavaScript is enabled, so you see this line.</p>");
</script>
<noscript>
<p style="color:#c92a2a">
Please enable JavaScript to use the dashboard.
</p>
</noscript>
</body>
</html>More Examples
<!DOCTYPE html>
<html>
<body>
<noscript>
<img src="https://picsum.photos/200" alt="Static fallback image" />
<p>This static image is shown when scripts cannot run.</p>
</noscript>
<p>Regular page content is always visible.</p>
</body>
</html>Use <noscript> to explain what a user is missing and to offer a basic, functional fallback. This practice is part of progressive enhancement.
Key Takeaways
- <noscript> content shows only when JavaScript is unavailable.
- When JavaScript runs, its content is ignored.
- It works in both <head> and <body> with different allowed content.
- Use it to give users a helpful fallback message.
- It supports progressive enhancement and accessibility.
