Skip to content

HTML <noscript> Tag

The <noscript> tag provides alternative content that is displayed in browsers that do not support scripts, or when the user has disabled script support. Otherwise, the browser ignores the tag and its content.

In HTML5 the <noscript> tag can be placed in the <head> and <body> elements. In HTML4 it can be used only in the <body> element. If the <noscript> is placed in the <head> tag, it must contain only the <link>, <style> and <meta> tags.

tip

You can use HTML comments to hide scripts from older browsers that do not support the <script> tag.

Syntax

The <noscript> tag comes in pairs. The content is written between the opening (<noscript>) and closing (</noscript>) tags.

Example of the HTML <noscript> tag:

HTML <noscript> Tag

html
<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
  </head>
  <body>
    <script>
      document.write("My first code in JavaScript!")
    </script>
    <noscript>Sorry, your Browser doesn’t support JavaScript!</noscript>
  </body>
</html>

Result

noscript example

Attributes

The <noscript> tag supports the Global Attributes and Event Attributes.

Practice

What is the purpose of the HTML <noscript> tag?

Dual-run preview — compare with live Symfony routes.