Strongly Emergent

What comes from combining humans, computers, and narrative

JavaScript Rehab: Whose Convenience Are We Talking About Here?

Here’s an antipattern that I see way too often: “please enable JavaScript for this site.” There are several levels of badness with this — I’m going to start with JavaScript itself.

JavaScript is actually pretty great: Brendan Eich’s problem child has many good parts and people are building genuinely astonishing things with it (recent favorite: Infinite Gangnam Style). You can do anything in JavaScript, just like Atwood foretold!

That’s the problem!

Despite the heroic efforts of browser-building folks, JavaScript is getting closer and closer to being equivalent to just downloading code and running it. That’s a bad thing. That gave us the 90s and the Bush years' legacy of viruses and botnets, of exploit after exploit. In addition to its many wonderful properties, JavaScript is also a gift to malware authors everywhere, a category that includes 90% of the analytics companies I’ve ever seen.

If running JS is not already equivalent to running arbitrary code on your machine, you would be prudent to treat it like it will soon become so and install NoScript or your browser’s equivalent.

Meantime, I see too many web developers who are drooling addicts to using JS for everything, who treat running JS on a user’s machine as their natural-born right. This is deeply not the case. It’s not hard to earn the privilege of running JS - you just have to make a value proposition! “Please enable JavaScript” is not a value proposition, it’s an admission of laziness (or an admission that some pointy-haired boss is in charge).

There are many things you can only do in JavaScript. Having JavaScript in your toolkit, as a web developer, is indispensable. But you also must know when you don’t need JavaScript, and to go without it when you don’t need it. If you can’t display text without JavaScript, if you can’t construct hyperlinks without JavaScript, if you can’t display images without JavaScript, you’re a bad person and you should feel bad.

On top of this, there’s the fact that a great deal of the JavaScript out there is designed for tracking, analyzing, and identifying users — you know, the sort of thing that makes Richard Stallman break out in hives. I am not against analytics — I am against users being simply mugged for that information. If the information has value, you don’t get it for free, analytics companies.

“JavaScript Rehab” is going to be a series of notes, added to when I happen upon sites like this, that names people who are addicted to JavaScript and encourages them to break the habit. I will also insult them, because over-using JavaScript is easy to avoid and the messages that tell you to enable it are usually condescending and dishonest.