Grow your CSS skills. Land your dream job.

Do you still use

  • # May 29, 2011 at 3:36 pm

    Hi there,

    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

    # May 30, 2011 at 2:15 am

    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.

    # May 30, 2011 at 3:13 am

    You should check out Modernizr.

    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.

    # May 30, 2011 at 6:28 am

    Hi

    For a newby – can you explain this feature a bit more ?

    Thanks

    # May 30, 2011 at 6:56 am

    @fjorko are you asking StephBertha or me?

    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:

    .no-js #slider{display: none;}

    and have the CSS hide a javascript slider or maybe something like

    .no-js #slider li{display: none;}
    .no-js #slider li:first-child{display: block;}

    That would hide all slides except the first.

    Those are just very small examples of how you could use the no-js class.

    # May 30, 2011 at 10:11 am

    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

    # May 30, 2011 at 9:05 pm

    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.

    # June 1, 2011 at 1:46 pm

    How big is the percentage of people with JS turned off ? I thought it was around 1%?

    # June 1, 2011 at 1:55 pm

    Correct. On top of that, users with JS turned off are guaranteed to understand that some things will not work properly.

    # June 1, 2011 at 10:49 pm

    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.

    # June 1, 2011 at 10:49 pm

    I still use HTML5 but I just have to be a bit more careful!

    # June 2, 2011 at 2:00 am

    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

    # June 2, 2011 at 6:07 pm

    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.

    # June 2, 2011 at 8:12 pm

    @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.

    # June 2, 2011 at 9:59 pm

    All I see is Java…I must be looking at the wrong place.

Viewing 15 posts - 1 through 15 (of 16 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".