HTML <noscript> Tag for Alternate Content

 

ATTENTION: THIS PAGE IS Valid HTML 5 AND IS BEST VIEWED WITH HTML 5 - Please upgrade your browser or download one of the HTML 5 compatible browsers such as Mozilla Firefox, Chrome, Opera or IE 9 (March 14, 2011 or later). For more information see HTML 5 browsers.


If you find this helpful, please click the Google +1 Button to the left, if it is white, to make it turn blue or red. Thank you! (It also helps find this page again more easily.)


PDF mobile

The <noscript> Tag in HTML 5

The noscript element provides alternate content that can be used when scripts are disabled in the browser or when scripting is unavailable for any other reason.


<noscript> Tag Syntax

Rules for coding HTML noscript elements
<head>
   ... metadata content ...
   <noscript>
      ... metadata content ...
   </noscript>
   ... metadata content ...
</head>
<body>
   ...
   ... flow content expected ...
   <noscript>
      ... flow content ...
   </noscript>
   ...
   ... phrasing content expected ...
   <noscript>
      ... phrasing content ...
   </noscript>
   ...
</body>
Rules for coding the HTML noscript element

Make sure you understand the difference between a tag and element and are familiar with the definitions of namespace and other HTML terms.

noscript element as metadata content
  1. Code the <noscript> tag in the <head> section of the HTML document where metadata content is expected.
  2. Begin the noscript element with a starting <noscript> tag. The element name uses lower case letters and should be in the HTML namespace, which it will pick up automatically from the xmlns attribute on the <html> tag.
  3. Include any global attributes inside the starting <noscript> tag as appropriate.
  4. Inside the noscript element, between the <noscript> start tag and the </noscript> end tag, code the alternate metadata for when scripts are disabled..
  5. End the noscript element with a matching </noscript> closing tag.
noscript element in the body
  1. Code the <noscript> tag in the <body> section of the HTML document where either flow content or phrasing content is expected.
  2. Begin the noscript element with a starting <noscript> tag. The element name uses lower case letters and should be in the HTML namespace, which it will pick up automatically from the xmlns attribute on the <html> tag.
  3. Include any global attributes inside the starting <noscript> tag as appropriate.
  4. Inside the noscript element, between the <noscript> start tag and the </noscript> end tag, code the alternate content for when scripts are disabled. If the <noscript> tag is coded where flow content is permitted, then the inner HTML of the <noscript> tag may contain flow content, otherwise it is restricted to phrasing content.
  5. End the noscript element with a matching </noscript> closing tag.

<noscript> Content Model

Contents of the noscript element
When coded in metadata content

When coded in metadata content, the content of the noscript element can include <link/> tags, <meta/> tags and style elements.

When coded in flow content

When coded in flow content, the content of the noscript element can include HTML comments, text content and any HTML tags that can be used in flow content.

When coded in phrasing content

When coded in phrasing content, the content of the noscript element can include HTML comments, text content and only those HTML tags that can be used in phrasing content.


<noscript> Tag Attributes

Attributes of the <noscript> tag
global attributes In addition to the personal attributes of the <noscript> tag below, any of the common HTML attributes can also be coded.

<noscript> Tag Examples

Examples of the noscript tag in HTML 5

Changes in HTML 5 - <noscript> Tag

What's new in HTML 5
Differences between HTML 5 and earlier versions of HTML

The 2000-2010 Recommendations from the W3C HTML Working Group defined the HTML namespace for the noscript element type name along with the names of all HTML element types. In older (pre-2000) versions of HTML, element type names were not associated with a namespace.


Valid HTML 5