I still use it! I don't like supporting those that have js turned off, but as much of my work is for the education department, and a surprising amount of their laptops have js disabled, i have no choice.
Add class="no-js" to your <html> element and it will be removed if JS is loaded. This isn't the only way to do it but it seems to be a very popular method at the moment. I make use of it.
Wrap anything within <noscript /> and it will only load if javascript has not loaded. For example: <noscript>Please turn on javascript!</noscript>
<html class="no-js"> & Modernizr:
Modernizr is very useful. Very basically, it provides feature detection along with some other cool features, such as HTML5 tag support for older browsers.
Very simply, Modernizr checks to see if <html> has a class of "no-js". If so, it removes it. This way, you could do something like:
.no-js #slider{display: none;}
and have the CSS hide a javascript slider or maybe something like
Obviously @fjorko Modernizr is JavaScript and so would only remove the no-js class if JavaScript was enabled. Just thought I would clear that up incase of confusion
You do have to be careful when using Modernizr as a fall-back for a site coded in HTML5. Any browser that doesn't support HTML5 and happens to have js turned off will cause some pretty big issues.
Not for what I do unfortunately. Monitoring tells me that roughly 10% of visitors to my sites have js disabled. And what makes it worse is that most of those visitors would not know what javascript is.
I just checked Google Analytics and it doesn't say anything about JS support, which I guess is kind of stupid to look as Google also uses a script to monitor stuff? lol
Its not stupid - Google Analytics requires javascript to work, so those without it aren't being tracked. It would be redundant to show a javascript statistic showing 100% of trackable users having javascript enabled.
@OniLinkCR They certainly do monitor js support, it can be a bit tricky to find though. It's on the Visitors Overview page, under the Browser Profile segment. And js support is currently at about 85% for my sites.
Do you guys still use for people who have JS turned off? I haven't seen anybody using it, just wondering if there's a reason to continue doing so.
- Steph
I don't like supporting those that have js turned off, but as much of my work is for the education department, and a surprising amount of their laptops have js disabled, i have no choice.
Add class="no-js" to your <html> element and it will be removed if JS is loaded. This isn't the only way to do it but it seems to be a very popular method at the moment. I make use of it.
For a newby - can you explain this feature a bit more ?
Thanks
I'll explain both:
The <noscript>:
Wrap anything within <noscript /> and it will only load if javascript has not loaded. For example:
<noscript>Please turn on javascript!</noscript>
<html class="no-js"> & Modernizr:
Modernizr is very useful. Very basically, it provides feature detection along with some other cool features, such as HTML5 tag support for older browsers.
Very simply, Modernizr checks to see if <html> has a class of "no-js". If so, it removes it. This way, you could do something like:and have the CSS hide a javascript slider or maybe something like
That would hide all slides except the first.
Those are just very small examples of how you could use the no-js class.
Its not stupid - Google Analytics requires javascript to work, so those without it aren't being tracked. It would be redundant to show a javascript statistic showing 100% of trackable users having javascript enabled.