Why Degrade Gracefully?

I got thinking today, as I near roll out of an internal helpdesk app heavily using jQuery, why we bother to degrade our scripts so they work without javascript. I get it: some people have javascript disabled in their browser… but my question is this: so what?

Javascript is a core part of web experience today.  In fact, I’d say that, on the desktop in the full browser front, if your browser doesn’t support at least HTML 4, javascript, and CSS 2, you’re not playing with the right tools.  After all, we expect that people can parse HTML, why not expect that javascript is a pre-requisite for web usage?

javascript

Some of us go to great pains to make sure our sites work should a user have javascript disabled.  But I’m actually considering the opposite: hiding certain critical elements if you don’t have javascript enabled to ensure that each visitor is on an even playing field.  Wrapping submit buttons in jQuery’s append() method, submitting data on click(), and plentifully exchanging JSON data via AJAX throughout ought to properly cripple participation of those who opt out of script execution on my site.

It all comes down to this: if you want your site to reach the widest audience possible, you need to anticipate that the client may not allow you scripting capability.  Conversely, on our intranet, and maybe one day on my websites, I’m doing the opposite: if you want to use the site, you’ve got to enable javascript: if you don’t, well… your loss.

Tagged , , , ,

7 thoughts on “Why Degrade Gracefully?

  1. Eugenia says:

    >why not expect that javascript is a pre-requisite for web usage?

    Because it can be dangerous. The reality is that browsers have bugs, and sites written in anything else than plain HTML have bugs. Security can be compromised, and this is not something that happens rarely. Therefore, there’s absolutely no reason to shove down the throat of the users dangerous circumstances that loads their PCs with malware.

    Personally, I run NoScript on my Firefox and I go nowhere without it. Only the sites I really trust I let them have their JS party. NoScript is the only reason why I haven’t jumped to Chrome too. I don’t move a muscle without it.

  2. HB says:

    It’s pretty much a matter of your content and targeted audience. If a site exists to showcase cutting edge technology, it can expect its audience to be able to see or otherwise use that technology. Kind of on par with sites starting to drop IE6 support. But if you’re providing information, there’s no sense in withholding it just because someone can’t see your fancy sliding carousel.

    The non-JS audience may be wider than you think, too. More and more physically disabled people are able to browse the web. Depending on your content, a surprising number of them might be your visitors.

    Many phone browsers still can’t process JavaScript, including my newish Samsung Instinct. I think it sucks when I can’t see a site on my phone, but if I’m not paying the developer I’m not about to complain to them. Unless you’re a government-funded site, there’s no law saying you have to cater to those crowds. However, it does cause me to think about my OWN sites’ accessibility.

    For your example of a company intranet, that’s a controlled audience. If you know 100% of your visitors are using some particular browser with JavaScript enabled and Flash installed (or whatever), of course you can and should code for that audience. Totally fine. It’s entirely different to assume that all non-JS visitors “in the wild” are actively working against you.

    EDIT: Also, there’s a bit of irony that some scripts on this site don’t work WITH JavaScript enabled… http://i31.tinypic.com/2rgdd7n.png 😉 No offense meant, just thought it was funny.

  3. AnyoneEB says:

    Actually, I do browse with lynx sometimes, especially if I am stuck on a very low bandwidth/unreliable connection.

    But for actual sane use cases: using Javascript to implement features on your website means giving the browser less information about what is going on. Particularly, when I visit a web site that uses Javascript for its links, I get annoyed because opening links in a new tab breaks. There are probably other examples of the same type of problem.

  4. Kroc Camen says:

    Because if making the site work without JavaScript is difficult, then you’re doing it wrong: http://remysharp.com/2008/12/12/stop-treating-ajax-as-something-special/

    If you have the right design patterns and the right HTML skills, JavaScript is what comes last, after everything is already working in HTML. There’s a good number of reasons why working without JavaScript is necessary:

    * Accessibility (a legal requirement for e-commerce in the UK)

    * Slow to initialise. Often I’ve clicked on things before the JS has started running; that should still work

    * Many people use NoScript: If I can’t see the primary info I’m looking for without JS, I move onto another site; you only get my trust when I have info by which to trust you with

    * Indexing, Google should be able to navigate without requiring JS

    * Mobile browser support may be varied or lacking

    * Maintainability. If you depend upon JS, then you have to maintain it. If the HTML is separate the JS layer can always be thrown away and rewritten easily

    For an Intranet, yes, that’s fine, requiring JS is hardly going to be a problem, but you should be using that opportunity to practice making things work without JS for future endeavours. Requiring JS for a public front-facing site is just a sign of a lack of HTML design skill and/or willpower.

    If JavaScript is the future, then those that can’t code things without it will be like the Dreamweaver users who can make something pretty but can’t code properly and those who can code to degrade gracefully will be like those who hand build sites. The Dreamweavers are going to be more common—but the hand builders simply do a better job.

  5. g says:

    You’re right. The blind have no business browsing the web. We should probably quarantine them as well…
    (Just to be on the safe side, I’m being cynical…)
    If your site does not degrade gracefully, people with disabilities, people running weird user agents and people blocking scripts can’t access the data you want them to see.
    That is neither smart nor fair.
    Code like a real (wo)man, with HTML first and only then add JS for the fancy stuff/AJAX to improve the basic site.

  6. Adam S says:

    @G: thanks for your constructive comment!

    I don’t agree with your presumption that no javascript means the site is automatically inaccessible by those with disabilities. I also think it’s silly to assume that anyone has to be “fair” with their own site. They may lose visitors, but it’s their own prerogative. As for those with “weird user agents” and those blocking scripts: well… tough. You know the risk when you intentionally pass a misleading UA and/or disable scripting.

  7. […] saw this post on a blog that blongs to the “main code monkey of […]

Leave a Reply

Your email address will not be published. Required fields are marked *