Since the <noscript>
content is only shown when JavaScript is disabled, you can't use an alert (since it's, well, JavaScript). If you need to call attention to the fact that the site requires JavaScript in order to operate properly, you're going to need some CSS.
One possibility is to stick a <link />
tag in the <noscript>
that loads a CSS file containing rules to hide everything except the error message. An extremely simple example (which just uses an embedded <style>
tag):
<html>
<head>
<meta charset="utf-8" />
<title></title>
<link href="http://netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css" type="text/css" rel="stylesheet" />
</head>
<body>
<div class="container">
<noscript>
<style>
.noscript { display:none; }
</style>
<div class="alert alert-danger">
<b>Sorry!</b> This site requires JavaScript. Please enable it in your browser.
</div>
</noscript>
<div class="noscript">
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris id blandit lacus. Nulla tempus ornare arcu vel iaculis. Duis sit amet interdum enim, sed molestie massa. Proin in leo nunc. Nullam justo felis, consectetur sit amet sapien ut, feugiat tincidunt arcu. Ut dignissim, nisl ut placerat interdum, odio nibh euismod ipsum, nec placerat est est tempor erat. Curabitur in ligula sed enim eleifend fermentum. Duis sit amet adipiscing eros. Mauris lacinia ut tortor sed accumsan.
</p>
<p>
Curabitur libero risus, sagittis sed urna ut, molestie fermentum enim. Donec fringilla pharetra neque sed ullamcorper. Phasellus ante lacus, rutrum eu ligula eu, mattis tempor metus. In tincidunt arcu non enim rutrum, at fringilla eros mattis. Nulla facilisi. Mauris eu elit id tellus ornare sollicitudin quis nec lacus. Curabitur aliquam porttitor enim, pretium vestibulum felis tristique id. Donec dictum congue turpis, sit amet dictum purus placerat quis.
</p>
<p>
Curabitur quis nulla consequat, adipiscing quam eget, vulputate nulla. Pellentesque elit ante, sagittis vitae magna id, adipiscing aliquet purus. Phasellus eros tellus, eleifend sit amet tellus vel, porta ultrices elit. Vestibulum tincidunt, ligula in gravida mattis, nulla mi blandit nulla, hendrerit sodales erat mauris sit amet nulla. Morbi congue imperdiet mi, vitae vulputate neque euismod a. Pellentesque consectetur, diam vel feugiat elementum, arcu enim faucibus risus, ut tempor leo magna sit amet augue. Donec justo nisi, lacinia et risus at, dapibus ultrices risus. In consequat felis id lectus dictum ornare. Proin egestas tortor urna, sed vehicula sapien gravida vitae.
</p>
</div>
</div>
</body>
</html>
<noscript>
tag, but NoScript Extension still blocks the JS from loading and the overlay never shows. – Biogeography