Skip to content

<noscript> - No Script Fallback

Scripting HTML5

The <noscript> element defines alternative content to display when JavaScript is disabled or not supported by the browser. It’s essential for progressive enhancement, accessibility, and ensuring your content is available to all users and search engines.

Result
<noscript>
<!-- Content shown when JavaScript is disabled -->
</noscript>

The <noscript> content appears when:

  1. JavaScript is disabled in browser settings
  2. JavaScript is not supported by the browser
  3. Script execution is blocked by security policies or extensions
  4. In crawlers/bots that don’t execute JavaScript
Result
Result
Result

Build from a solid foundation:

<!-- Level 1: Works without JavaScript -->
<form action="/search" method="GET">
<input type="search" name="q" placeholder="Search...">
<button type="submit">Search</button>
</form>
<noscript>
<p>Basic search is available. Enable JavaScript for
autocomplete and instant results.</p>
</noscript>

The <noscript> element can be used in <head> or <body>:

<head>
<title>My Page</title>
<!-- Redirect to no-JS version -->
<noscript>
<meta http-equiv="refresh" content="0; url=/nojs.html">
</noscript>
<!-- Load fallback stylesheet -->
<noscript>
<link rel="stylesheet" href="/css/nojs.css">
</noscript>
</head>
Result
Result
Result
Result

Search engines handle <noscript> differently:

Result

The <noscript> element supports accessibility:

Result

Universal Support

The <noscript> element is supported in all browsers:

  • All browsers: Full support
  • All versions: Since HTML 4.01
  • Mobile: Complete support

Note: Content is displayed when scripting is disabled or unsupported.

  • <script> - Embed JavaScript code
  • <template> - Inert content templates
  • Modernizr - JavaScript library for feature detection
  1. Always provide fallback: Don’t assume JavaScript is available
  2. Meaningful content: Include actual content, not just warnings
  3. Progressive enhancement: Build foundation that works without JS
  4. SEO-friendly: Ensure search engines can access content
  5. Clear messaging: Explain what’s missing without JavaScript
  6. Testing: Actually disable JavaScript and test
  7. Graceful degradation: Core features should work without JS
  8. Accessibility: Make fallback content screen-reader friendly
  9. Avoid dependency: Don’t make entire site JavaScript-dependent
  10. Performance: Consider that <noscript> content adds to page weight

❌ Avoid

  • Empty or minimal warnings
  • “Please enable JavaScript” only
  • No actual content in noscript
  • Assuming everyone has JS
  • Hiding all content without JS

✅ Do Instead

  • Provide full content fallback
  • Explain what features need JS
  • Make core content accessible
  • Test without JavaScript
  • Use progressive enhancement

Learn More: