How to set alternate content for users that do not support client-side scripts ?

In this article, we define an alternate content for users that do not support client-side scripts by using <noscript> tag in the HTML document. It is used to display the text for those browsers that does not support script tag or the browsers disable the script for the user.

Syntax:

<noscript> Contents... </noscript>

Example:

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
  
<head>
    <style>
        body {
            text-align: center;
        }
  
        .gfg {
            font-size: 40px;
            font-weight: bold;
            color: green;
        }
  
        .geeks {
            font-size: 25px;
            font-weight: bold;
        }
    </style>
  
    <noscript>
        Sorry, your browser does 
        not support JavaScript!
    </noscript>
</head>
  
<body>
    <div class="gfg">
        GeeksforGeeks
    </div>
      
    <div class="geeks">
        How to define an alternate content
        for users that do not support 
        client-side scripts?
    </div>
      
    <script>
        document.write("GeeksforGeeks!") 
    </script>
</body>
  
</html>           

chevron_right


Output:

Supported Browser are listed below:

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Opera
  • Safari

full-stack-img




My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.