Display non-Javascript page for browser with no Javascript support

When a browser doesn’t support Javascript, or simply have it disabled, it’s best to include an alternative non-Javascript content for the page to remain functional.

This is made possible with the noscript tag, and the example below will pop up the alert if Javascript is enabled or supported, and display the text instead if it doesn’t.

<script type="text/javascript">
    window.alert("I support Javascript")
</script>
<noscript>
    I do not support Javascript
</noscript>

Sign up for The Complete JavaScript Course: Build Real Projects! and many other great courses on Udemy to learn more.


Written by Mohd Shakir Zakaria. Last updated on 2019-02-12