How to detect if JavaScript is disabled with HTML?

Spread the love

Sometimes, we want to detect if JavaScript is disabled.

In this article, we’ll look at how to detect if JavaScript is disabled.

How to detect if JavaScript is disabled with HTML?

To detect if JavaScript is disabled, we use the noscript tag.

For instance, we write

<noscript>
  <style type="text/css">
    .pagecontainer {
      display: none;
    }
  </style>
  <div class="noscriptmsg">
    You don't have javascript enabled. Good luck with that.
  </div>
</noscript>

to render content in the noscript tag if JavaScript is disabled in the browser.

Conclusion

To detect if JavaScript is disabled, we use the noscript tag.

Leave a Reply

Your email address will not be published.