The Javascript Web Is Breaking
Tired of App Store redirects on hacked websites, I disabled JavaScript on mobile Safari and found a whole new web. Faster. More legible. Emptier.
I tweeted that this morning.
Javascript is ubiquitous, except when it’s not
At An Event Apart San Francisco this year, Jeremy Keith gave us all a refresher on why progressive enhancement is important. While crazy fast and reliably consistent javascript engines are nestled within even the mobilest of web browsers these days, javascript is only as reliable as the network hosting it. In other words, if your website requires javascript to render its content, your website can be unusable when accessed from a restricted or poorly performing network. Jeremy sited an awesomely detailed example by the UK’s Government Digital Service. The UK government is really goot at making websites. They are likely better at it than you are. When they give a compelling reason to not require javascript, you should not require javascript.
Mobile requires javascript
This morning I had a wakeup call when trying to read an (admittedly trashy) article on the Huffington Post. I was repeatedly redirected to the App Store to download some shitty free-to-play game. Sadly, this seems to be happening more frequently with ad heavy websites.
When I run into this issue, I usually just give up and find something else to read, but it was 5 a.m. and I had nothing better to do, so I disabled javascript in my browser. I was pleasantly surprised that the article became much easier to read. It was missing all the annoying back and fourth slidey buttons on the sides of the screen, the giant social media bar at the bottom of the screen was gone, and there were no ads to be seen! Also conspicuously missing, however, was the ability to navigate the site. Turns out m.huffpost.com is a really short website if you don’t have javascript.
After I finished my (horrible, trashy) article, I decided to try out a few other websites with javascript disabled. As it turns out, lots of websites use the “huffpo sansnav” model. They get easier to read, but impossible to navigate. For shits and giggles, I decided to try Facebook1. It had the opposite problem: navigation but no content.
The one exception to the brokenness of my javascript experiment was nytimes.com. The New York Times website is delightful to use without javascript. The type is larger, the fonts better, and the navigation is fully functional. Plus: no ads!
Don’t needlessly break the web
HTML is fault tolerant by design. Browsers ignore tags they don’t understand, but still render the content within them. This not only makes it easy to add new elements to HTML, it also makes old websites future proof. It is forgiving. You can make an error and the content will render.
CSS is also fault tolerant by design. Browsers ignore rules and selectors they don’t understand, but still render the page.
Javascript is not fault tolerant. If you put a semicolon in the wrong place, the script doesn’t execute. If your website has a javascript library dependency that is not available from a visitor’s network, your site may be less useable than Facebook without javascript. To paraphrase Jeremy Keith, Don’t put all your imporant shit in the most rickety part of the web.
In my Huffington Post example above, all the dependencies were available, including the shady App Store redirect javascript. If your site is unusable because of javascript and without javascript, there is little hope for you.
- When they split the messaging system into a separate app, I took a stand and deleted the Facebook app from my phone and went back to the mobile site. Turns out, having a back button is really handy. ↩