You cannot rely on JavaScript being available. Period.

I have a question for people who label themselves as JavaScript developers: Have you forgotten about, never heard of, or never cared about the terms progressive enhancement, graceful degradation, and Hijax? If the answer is yes, then please tell me why.

I would also like to know whether you actually consider disregarding those best practice methods to be compatible with modern, responsible, and professional JavaScripting.

The reason I'm asking this is that I have recently read no less than three articles in which WaSP member Ian Lloyd describes the problems he has been having with certain online services (Blogger, Bloglines, and Ma.gnolia). All three services use JavaScript in ways that make them fail, without warning or explanation, when scripting is disabled or blocked by firewalls.


Ian posted the first article, Blogger - Can I get in please?, after realising that he could not log in to his Blogger account from his place of work. The reason? The firewall at his office (and no doubt in many other offices across the world) is configured to block suspicious JavaScript.

On Blogger's home page (looks like they've been doing some tweaking on their own since Doug Bowman helped them redesign a couple of years ago) there is a script that writes the login form to the page. If scripting is not available, a fallback is provided in a noscript element. Not exactly elegant, but it does work if JavaScript is fully disabled. In Ian's case JavaScript is enabled but parts of it is blocked, making both the script and the fallback fail.

The lesson to be learned is to put submit buttons in the actual markup that all browsers receive, not in a noscript element (which is a sign of outdated development methods anyway).


The second service to break down was Bloglines. Ian notes the problems he encountered in Bloglines Is Broken (for me, at least).

The reason is apparently that Bloglines started using one of those very popular, <irony>absolutely fantastic and time saving</irony> JavaScript frameworks. That framework happens to trigger a security setting in the firewall at Ian's office. Troubleshooting that should be pretty easy if the developers had known the code they use, but having decided to rely on a script library written by someone else they seem to have a bit of trouble figuring out exactly what is causing the problem.

The lesson to be learned here is that if you start using JavaScript frameworks you should be prepared to spend lots of time enterpreting and learning to understand the code someone else wrote when you run into trouble.


Next up is Ma.gnolia, a service which in Ian's words (and I agree) is Using a sledgehammer to crack a nut.

What it comes down to is the submit "button" in Ma.gnolia's login form requiring JavaScript. I simply cannot understand why anyone would make a submit button require JavaScript, especially without providing any visible fallback or information for people browsing with JavaScript off. Looking at the code they use I can only shake my head and wonder what they were thinking. Yes, it works if JS is off and you hit enter. But how is the user supposed to know that? The button is still there, begging you to click it, but nothing happens when you do.

If I may make a suggestion, here's the approach I would use if a visual designer pointed a gun at my head, threatening to pull the trigger unless I get rid that default, horribly ugly, and user-recognisable button:

  1. Put a normal, honest, bullet proof, works-everywhere submit button in the markup.
  2. Do not use CSS to hide it.
  3. If JS is available, hide or remove it and insert the fancy-schmancy styled link instead.

Done. Progressive enhancement (if you can call that enhancement) instead of dis-graceful degradation.

How many others are making similar mistakes?

It's very disturbing to see this trend of not giving any (or enough) thought to what will happen when a browser doesn't support the technologies you want to use. It's even more disturbing to see the JavaScript framework craze sweeping through the developer community make people use JavaScript for all sorts of things that are better done without it.

JavaScript frameworks seem to have a lot in common with the DHTML libraries of the late nineties - start using them and common sense goes out the window unless you have the experience to use them right. I admit that I too went overboard with scripting around the turn of the century. But I think I learned my lesson. I really hope I did.

Before you start accusing me of being anti-JavaScript, let me assure you that I am nothing of the kind. JavaScript used right is a great tool which I find myself using more and more. The key is to use it responsibly and always in the spirit of progressive enhancement or Hijax.

I thought we were over the reckless scripting practices of the 20th century. Apparently I was wrong.

Posted on December 4, 2006 in JavaScript, Accessibility