The <noscript> Element
As defined in the HTML Living Standard, the <noscript> element is used to provide fallback content for users who have disabled JavaScript in their browser or are using a browser that does not support it.
<noscript>
<p>This site requires JavaScript to function fully. Please enable it in your browser settings.</p>
</noscript>
While JavaScript is ubiquitous, providing a <noscript> fallback is a hallmark of resilient, accessible design.
Accessibility Impact: Graceful Degradation
For some users, disabling JavaScript is a security or privacy choice. For others, it may be a necessity due to the limitations of their assistive software.
WCAG Requirement: Robustness
Principle 4: Robust. Content must be robust enough that it can be interpreted reliably by a wide variety of user agents, including assistive technologies.
If your site's primary navigation or core functionality depends entirely on JavaScript, a <noscript> message is the minimum requirement to inform the user why the page isn't working and how to fix it.
Best Practices for Noscript Fallbacks
- Be Helpful: Don't just say "JS is disabled." Tell the user what they are missing and provide a link to a simplified version of the page if possible.
- Avoid Layout Shifts: Ensure the
<noscript>content doesn't cause a massive jump in content when it appears. - Don't Over-rely: The best "noscript" strategy is to build a site that works without JS first, then enhance it with JS (Progressive Enhancement).
A11y Tip: The "No-JS" Class
A common pattern is to add a class to the <html> tag and use a small inline script to change it to . This allows you to style the page differently for users without JavaScript using CSS.