HTML HTML Tutorial HTML Forms HTML Graphics HTML Media HTML APIs HTML Tags



HTML Tag: noscript

The noscript tag is an HTML tag that is used to provide an alternative content for users who have disabled or have not installed JavaScript in their web browsers. It is a container tag that is used to enclose content that should be displayed to users who do not have JavaScript enabled in their browsers.

The noscript tag is used to provide an alternative content for users who have disabled or have not installed JavaScript in their web browsers. When a web page is loaded, the browser first checks if JavaScript is enabled or not. If it is enabled, the browser executes the JavaScript code and displays the content accordingly. However, if JavaScript is disabled or not installed, the browser ignores the JavaScript code and displays the content enclosed within the noscript tag.

The noscript tag is particularly useful for web developers who want to provide an alternative content for users who have disabled or have not installed JavaScript in their web browsers. This can include important information, such as instructions on how to enable JavaScript or a warning that the website may not function properly without JavaScript.

Here are some examples of how the noscript tag can be used:

Example 1: Display a message when JavaScript is disabled

If JavaScript is disabled in the user's web browser, the following message will be displayed:

  <noscript>
    <p>JavaScript is disabled in your web browser. Please enable JavaScript to view this website.</p>
  </noscript>

Example 2: Provide an alternative content when JavaScript is disabled

If JavaScript is disabled in the user's web browser, the following alternative content will be displayed:

  <script>
    document.write("This is the content that will be displayed if JavaScript is enabled.");
  </script>
  
  <noscript>
    <p>This is the content that will be displayed if JavaScript is disabled.</p>
  </noscript>

Example 3: Display a warning message when JavaScript is disabled

If JavaScript is disabled in the user's web browser, the following warning message will be displayed:

  <noscript>
    <p>Warning: This website may not function properly without JavaScript.</p>
  </noscript>

Activity