Is it okay to build sites that rely on JavaScript?
Progressive enhancement raises a lot of strong opinions; we ask the experts if it's acceptable to build sites that don't work without JavaScript.
Back in 2016, Nolan Lawson ignited a bit of web controversy when, during a talk at the Fronteers Conference in Amsterdam, he suggested that it's okay to build a website that doesn't work without JavaScript, and then followed up with a blog post in which he argued that narrow interpretation of progressive enhancement – start with HTML, then add CSS, then add JavaScript – doesn't really make a lot of sense.
So, given that nearly everyone has a JavaScript-enabled browser what with it being 2018 and everything, is it okay to build sites that don't work without it? We asked our panel of experts.
Point of failure
Consultant frontend architect Harry Roberts got straight to the point: "In a word: No. In many words: Full JS apps are fine provided that a) They have their first render on the server, and b) They give me some content if that JS fails to load. It's less about availability of JS, and more about not entrusting flaky network connections with delivering our entire app in one render-blocking package. That's the problem. Don't make JS your app's single point of failure."
(Sarcastically) Yes!
"As long as you're fine with the site completely failing because the browser is too old, or too new, or the user's bandwidth is too constrained, or the server hiccups, or a firewall's security policy blocks it, or a dependency goes sideways, or you accidentally drop a semicolon somewhere, then sure," says consultant and author Eric Meyer, "it's OK. What you build won't be a part of the web continuum, and it will be needlessly fragile, but that's a choice you can make."
Offline-first, first
It's all a matter of priorities, says the man who kicked off the debate in the first place, Nolan Lawson. "The question we should be asking ourselves is not how well our sites work without JS, but how well they work under poor or nonexistent network conditions," he suggests. "These concerns are often conflated, but they're not the same. Every year smartphones represent an increasing share of web traffic, but mobile networks have not caught up.
"So offline-first – treating the network as an enhancement with JS tools like Service Worker and IndexedDB – has become the new standard for building fast, resilient websites. It is possible to do both traditional progressive enhancement and offline-first, but it's not easy. We should prioritise offline-first over works-without-JS."
As long as it's done well
For web designer and developer Lea Verou it's probably all right, with reservations. "For web apps (e.g. Google Docs), it's a loud 'Yes'," she says, "since their functionality cannot be replicated without JavaScript. For content-based websites, it gets a bit trickier. Sure, except for a few weirdos nobody disables JS anymore, and it is technically possible to make an accessible, lightweight site that depends on JS. Also, if there is a JS error anywhere, the content breaks, which is a terrible experience (not concatenating all JS files helps alleviate this a bit). So, I guess my answer is, yes if done really well; no otherwise."
Get top Black Friday deals sent straight to your inbox: Sign up now!
We curate the best offers on creative kit and give our expert recommendations to save you time this Black Friday. Upgrade your setup for less with Creative Bloq.
Functionality before features
"The core functionality of any service on the web should be available to the widest number of people," says Jeremy Keith. "The best way to ensure this is to use the simplest possible technology for that core functionality. But once you've got that in place, you can go absolutely crazy with JavaScript ... including adding more functionality that requires JavaScript to work. I'm reminded of what Mat Marquis said when working on the Boston Globe site: 'Lots of cool features on the site don't work when JavaScript breaks; 'reading the news' is not one of them.'"
Power and responsibility
Developer evangelist Christian Heilmann suggests that the question isn't about JavaScript, it's more about responsibility and power. "You can create a solution delivering the most important use case using HTML and CSS and enhance with JavaScript. This could, however, be very basic and not what people expect nowadays.
"If you rely on JavaScript you have full control, but also full responsibility over the delivery and the error handling. Problems like flaky connections can't be solved without JavaScript. Our job on the web is to create experiences that are available and great to use. We do this by using all of our tools responsibly."
Does anything really need JavaScript?
"Your project may require client-side JavaScript," says Aaron Gustafson, author of Adaptive Web Design, "I'd argue most don't. Most can benefit from client-side JavaScript to improve the user experience (including by providing a good offline experience), but creating an experience that benefits from client-side JavaScript is not the same as creating one that requires it. It's an important distinction that is often overlooked."
Web design event generate London returns on 19-21 September 2018, offering a packed schedule of industry-leading speakers, a full day of workshops and valuable networking opportunities – don’t miss it. Get your generate ticket now.
Related articles:
Thank you for reading 5 articles this month* Join now for unlimited access
Enjoy your first month for just £1 / $1 / €1
*Read 5 free articles per month without a subscription
Join now for unlimited access
Try first month for just £1 / $1 / €1
Ruth spent a couple of years as Deputy Editor of Creative Bloq, and has also either worked on or written for almost all of the site's former and current design print titles, from Computer Arts to ImagineFX. She now spends her days reviewing small appliances as the Homes Editor at TechRadar, but still occasionally writes about design on a freelance basis in her spare time.
Related articles
- Womp's cool new feature will 3D print your creations – and get them delivered to your door
- I learnt these 3 cool software tricks when I visited Apple HQ
- Why Dragon Quest III HD-2D Remake's 'zombie tech' is the future of retro-gaming
- Last night I saw how Acer is one of the few laptop manufacturers taking plastic waste seriously