Sometimes, we want to detect if JavaScript is disabled with HTML.
In this article, we’ll look at how to detect if JavaScript is disabled with HTML.
How to detect if JavaScript is disabled with HTML?
To detect if JavaScript is disabled with HTML, we add 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 add the noscript tag with the content that’s displayed when JavaScript is disabled.
Conclusion
To detect if JavaScript is disabled with HTML, we add the noscript tag.