I am working on a site which is only available to JavaScript enabled browsers. What is the best way to provide a warning to non-JavaScript browsers? Obviously entails using <noscript>, but I would appreciate a little more detail. I was thinking of something like the following, but it does not work, nor even validate. Any thoughts? Thanks
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body class="wrap">
<noscript>
<h1>JavaScript is turned off in your web browser.<br />Turn it on to use this site, then refresh the page.</h1>
<style type="text/css">
body { display:none; }
noscript { display:block !important; }
</style>
</noscript>
HTML for JavaScript browsers goes here...
</body>
</html>
Try disabling javascript, then reload Stackoverflow. That is a nice clean way to ask users to enable javascript.
Then render the site as best you can. Don’t worry about hiding your page content for javascript disabled browsers.