The
<noscript>tag defines alternative content that is displayed only when JavaScript is disabled in the browser or when the browser does not support scripting.This ensures that users without JavaScript can still view important content or messages on your web page.
Syntax
<noscript>
Alternate content displayed if JavaScript is disabled.
</noscript>Attributes
| Attribute | Description |
|---|---|
| (None) | The <noscript> tag does not have any specific attributes. It can include global attributes like id, class, or style. |
Example
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>noscript Tag Example</title>
<script>
document.write("<p>JavaScript is enabled in your browser.</p>");
</script>
</head>
<body>
<noscript>
<p>Your browser does not support JavaScript or it’s disabled. Please enable JavaScript to view the full content of this page.</p>
</noscript>
</body>
</html>Output
Browser Output
When JavaScript is enabled, it will display:
“JavaScript is enabled in your browser.”
When JavaScript is disabled, it will show:
“Your browser does not support JavaScript or it’s disabled...”
Try this in our TryIt Editor to see the difference between JavaScript-enabled and disabled states.
Browser Support
Chrome | Firefox | Edge | Safari | Opera | IE9+ |
|---|---|---|---|---|---|
| ✅Yes | ✅Yes | ✅Yes | ✅Yes | ✅Yes | ✅Yes |
All major browsers support <noscript> tag.
Notes
- The
<noscript>element provides a fallback for non-JavaScript environments. - It is often used for warnings, accessibility, or alternate content.
- Always ensure your website remains usable without JavaScript when possible.
- This tag works inside both
<head>and<body>elements.
Conclusion
The <noscript> tag ensures your webpage remains accessible and informative even if JavaScript is unavailable.
It helps maintain usability and accessibility standards, providing fallback content for all users.