Arthur Guiot Arthur Guiot - 8 days ago 6
HTML Question

How block the site and display a banner for users who doesn't use javascript?

I'm trying to block my website for all users who doesn't use javascript (for security), and display a big alert to notify those users that they have to use JavaScript. Is there a solution with

<!--[if ]>
tags or even the
<noscript>
?

Answer

The noscript html tag can be used to display a message when javascript is turned off.

Another approach could look like this:

<div id='noscript'>show non-js content</div>
<script>document.getElementById('noscript').style.display='none';</script>

Where the message/element is hidden if javascript is off.