Enforcing Javascript upon users with CSS?

This does not validate. AFAIK, it still works in all modern browsers.


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<style type="text/css">
#noscript{display:none;}
</style>
<script type="text/javascript">
// Insert your annoying Javascript here.
</script>
<noscript>
<style type="text/css">
div{display:none;}
#noscript{display:block;}
</style>
</noscript>
</head>
<body>
<div id="noscript">
Insert a painfully long description on how to enable Javascript in the most common browsers.
</div>
<div id="container">
Insert your REAL site here.
</div>
</body>
</html>


Can anyone think of when this will not work? What problems could this cause? The only reason this doesn't validate is because <style> tags aren't supposed to be inside <noscript> tags.Erm, why are you even bothering with that? By default, browsers will not display the contents of a noscript element unless scripting is not available. So it's kind of wasted effort.Why would you want to make users enable JavaScript. If a user does not have JavaScript enabled it is either through a personal choice or perhaps some unfortunate circumstance such as lack of sight.

Blind users have to use screen readers or braille displays that simply don't cannot JavaScript.

I myself recently decided to disable JavaScript, I made a choice, why do you want to force me to un-make my choice?
 
Back
Top