There was a post this morning asking about how many people disable JavaScript. Then I began to wonder what techniques might be used to determine if the user has it disabled.
You don't detect whether the user has javascript disabled (server side or client). Instead, you assume that javascript is disabled and build your webpage with javascript disabled. This obviates the need for noscript
, which you should avoid using anyway because it doesn't work quite right and is unnecessary.
For example, just build your site to say
Then, your script will simply do document.getElementById('nojs').style.display = 'none';
and go about its normal JS business.