Skip to content
Tutorials Center
My learning

Topics

HTML Reference Β· Scripting

The <noscript> element

Reference for the HTML <noscript> element: content shown only when scripting is off, what it may contain in the head and body, its limits, and technical details.

The <noscript> element holds content that the browser uses only when scripting is disabled (or not supported). When JavaScript is running, the browser ignores everything inside it. It is a simple way to tell visitors without JavaScript that a feature needs it, or to offer a script-free alternative.

You can use it in the <body>, where it can hold ordinary content, and in the <head>, where it can only hold <link>, <style> and <meta> elements.

HTML
<noscript>
  <p>The route planner needs JavaScript. You can still
  <a href="/timetables.pdf">download the printed timetables</a>.</p>
</noscript>

Try it

Scripting is on, so noscript stays hidden

This preview always runs scripts, so the red warning never appears. Turn off JavaScript in your browser's site settings and open a page with this markup to see the other branch.

Attributes

This element has no attributes of its own. It accepts the global attributes.

Usage notes

  • Prefer progressive enhancement. Instead of a "please enable JavaScript" message, build the page so its core content and links work without scripts, and let JavaScript add extras. <noscript> then becomes a small hint rather than a wall.
  • It doesn't catch script failures. If scripting is on but your script fails to load, has an error or is blocked by an extension, <noscript> content still stays hidden. For those cases, show a fallback by default and hide it from JavaScript once your code runs.
  • In the head. Use it there for things such as a stylesheet that reveals content normally shown by a script: <noscript><link rel="stylesheet" href="/no-js.css"></noscript>. Nothing else is allowed in the head version.
  • No nesting. A <noscript> can't contain another <noscript>.
  • HTML syntax only. The element has no effect in XML (XHTML) documents.
  • Tracking pixels. Analytics services often ask you to put an <img> in <noscript>. That loads only for visitors without scripts; consider whether you need it at all.

Technical summary

Content categories Metadata content, flow content, phrasing content
Permitted content When scripting is disabled: in the <head>, zero or more <link>, <style> and <meta> elements; elsewhere, transparent but with no <noscript> descendants. When scripting is enabled: text, which is not parsed as markup
Tag omission None; both the start and end tags are required
Permitted parents A <head> element, or any element that accepts phrasing content, as long as there is no <noscript> ancestor
Implicit ARIA role No corresponding role
DOM interface HTMLElement
Default display none when scripting is enabled; otherwise inline

Browser support

Supported in every browser.