Noscript (<noscript>)

When to use 

Use the <noscript> element to represent its children if JavaScript is disabled in the user agent. If JavaScript is enabled, then the <noscript> element represents nothing. 2

Rules

  • There are many reasons why JavaScript might be disabled on a website. This is way progressive enhancement is an important accessibility tool. It describes, that the website works as a static website without JavaScript. JavaScript then adds interactivity to the static site. This way a website is mostly usable even when JavaScript is disabled.
  • Most of the time progressive enhancement can best be accomplished without the use of the <noscript> element. This is because the element is a very blunt tool and thoughtful progressive enhancement achieves better results most of the time. 2
  • A use-case for this element could in cases where the website absolutely does not work without JavaScript. In such situations creating an alternative content via the <noscript> element that states that the website does not work when JavaScript is disabled, does at least let the user know why the website is failing. 1
  • The element could also be used to redirect a user to a site that works without JavaScript. 1

Sources 

  1. WebAIM: Accessible JavaScript © WebAIM
  2. HTML Spec: 4.12.2 The noscript element is licensed under Creative Commons Attribution 4.0 International License
Created at: 09.06.2023, Last updated at: 11.06.2023