How HashbangsPoor Execution And Practices Break The Web

Gawker is loading an article&

Earlier today I tweeted a link to a Sitemeter page showing a massive drop in Gawker traffic. At first I thought the Sitemeter system was just incapable of accurately measuring traffic in a hashbang-world, but then Mike Davies noticed that it’s probably just to do with them dropping Sitemeter on their redesign and leaving it only in place on their UK site.

Then I went to visit itself to verify this, during which I spotted an article whose headline caught my interest. I clicked on it in the right sidebar. I saw it load up AJAX-style in the left pane, with the above-shown loading spinner still on top of it, blanking out the article by making it only 10% opaque. As I write this, many minutes and a couple discussions later, the Gawker site is still waiting to “load” the article. The article that loaded up just fine, but was never revealed because of…

A simple JavaScript error.

I then copied the URL from the address bar and emailed it to myself, opening it up on my iPhone to see what happened there. Well, not much happened: I was simply redirected to the main page of the Gawker mobile site. Not the article I requested, just the main page. Had it been an article no longer near the front page, I wouldn’t have been able to find it back and open it on my iPhone, ever.

To verify that bold assessment, I looked up some old Gawker article from May 2010, searched (on my iPhone) for the exact title string, found the exact article, tapped on it, and thanks to Gawker using a combination of the generally wrong practice of UserAgent sniffing and a broken Hashbang-implementation, I was again returned to, not seeing the article I tapped to see. The mobile site also doesn’t allow you to search their archives, so my bold assessment turned out to be entirely correct.

As Tim Bray explained with his 5-step run-through of what happens when using hashbangs, a web server is incapable of accessing the fragment identifier (the part after “#”) and thus can only be told what content to show if the client-side JavaScript tells it something. And the discussion over at Aaron Gustafson’s blog points out that third-party advertising scripts can break that client-side JavaScript well beyond anything you could ever do on your site to make it work.

Hashbangs may not be quite the most evil thing on the Web today, but since you simply can never do a hashbang-implementation perfectly right, you probably should not be doing one at all. There are situations where it could be considered acceptable, e.g. if you’re building a sophisticated web app that wouldn’t make sense not to rely on JavaScript in the first place, but for any general content-driven website, the fragility of the Hashbang-approach makes it a disproportionately huge barrier to people wanting to access that content. And if you then combine it with bad practices to boot, you’re really just doing yourself and your audience a disservice. And if you’re a publication like Gawker, with many writers working for you writing the content on these sites, you’re not just doing yourself and your audience a disservice, you’re actually hurting the Web and our society by extension. As Jaron Lanier argues:

“The crucial question,” he said, ”ultimately has to do with power. If the future is one in which writers are not paid, then it also is one in which writers lack clout. And if it’s a future in which writers lack clout, then what we have is a lack, basically, of an intellectual middle class. Instead we have a sort of volunteer intellectual class, which in terms of clout starts to resemble peasants.”

The more fragile access to your content becomes, the less likely you’re able to make money off of it, the less likely your writers will get paid what they should be. The implications of extending that are significant. Sooner or later, Gawker will reverse their decision on using hashbangs—I guarantee it. I just hope that they’ll do so before more sites follow their poor example and start eroding the foundation of their own business in an attempt at being “hip, modern and cool” as well.

If you liked this, you should follow me on Twitter!