Too much JavaScript

JavaScript offers developers a great deal. The fact that it runs in the browser keeps user experience fast and responsive. The ability to recognise user actions that HTML can’t allows more sophisticated interactions to be created. However, there’s now a tendency to include JavaScript and interaction where it’s not strictly necessary. There’s a feeling within design agencies that every site has to incorporate bells and whistles. If you’re creating something for a client, you need to include gee-whizz elements to show you’re really working for your money.

For the most part, many clients are perfectly happy with this. A shiny site, with clever forms and icons that change when the users mouse over them, means that they’re getting a lot of bang for their buck. After all, according to research carried out at the end of 2010 (, the vast majority of web browsers have JavaScript switched on, so you’re hitting everyone … right?

It’s easy to assume that everyone online is using an up-to-date browser, enjoys the clever interactive elements and can cope with the proliferation of JavaScript online. But consider the many people who either don’t have the latest browsers, or are within an environment in which JavaScript is disabled. This is not as rare as you may imagine.

Many government departments and public sector organisations have serious restrictions on their internet access. Social sites can be blocked entirely and JavaScript can be disabled on their four- to five-year-old version of Internet Explorer.

This means your flashy new site may not even be visible to some of the public bodies you’re either working with or trying to impress. Even the simplest site created for a client may not display correctly or, worse, actually work when viewed from within some of the commercial organisations that are there specifically to help new businesses.

The wider population

In addition, many areas of the world are still using old, low-powered, second-hand computers, have slow internet access and are dealing with even older, slower software. And this is small potatoes when compared to the problems JavaScript can introduce into a site for someone with disabilities.

With increasing numbers of public services now being accessed primarily through the internet, the number of disabled people online is growing incredibly quickly. Yet many agencies don’t recognise the problems these users can face when they come across the clever JavaScript in a website.

Text-to-speech interpreters and magnification tools can operate incorrectly or, in some cases, crash an entire page when encountering some hastily inserted JavaScript. Or, if the site is wholly reliant on JavaScript, then it doesn’t work at all.

These are issues that far too few developers consider when planning a new project or creating something specific for a client. The number of sites with no ‘Plan B’ for the situation where the user has JavaScript switched off is quite incredible (have a play with your favourite JavaScript sites and see).

An over-reliance on JavaScript is not only likely to lose you (or your client) customers, but in some cases you’re losing out on profile and page rank, since search engine spiders don’t routinely index content generated by JavaScript. Worst of all, you’re actively ignoring a whole audience of people who may be entirely reliant upon your website for access to information or services, thanks to some poorly placed JavaScript.

JavaScript is a clever piece of technology. It’s useful in a number of areas, enabling websites to offer more flexibility and interactivity than HTML alone. However, it has to be considered in the context of the audience. Who’s going to be using this? Are they going to have JavaScript? If they don’t, if they have an older browser, if it has JavaScript switched off, or if they’re using additional technology to read or access the site, will it work?

Some simple questions can mean the difference between having a site that provides a few with an all-singing, all-dancing experience and one that works for everyone. Sometimes a bit less can mean an awful lot more. To people who really need it.

This article originally appeared in issue 217 of .net magazine - the world's best-selling magazine for web designers and developers.

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

The Creative Bloq team is made up of a group of design fans, and has changed and evolved since Creative Bloq began back in 2012. The current website team consists of eight full-time members of staff: Editor Georgia Coggan, Deputy Editor Rosie Hilder, Deals Editor Beren Neale, Senior News Editor Daniel Piper, Digital Arts and Design Editor Ian Dean, Tech Reviews Editor Erlingur Einarsson and Ecommerce Writer Beth Nicholls and Staff Writer Natalie Fear, as well as a roster of freelancers from around the world. The 3D World and ImagineFX magazine teams also pitch in, ensuring that content from 3D World and ImagineFX is represented on Creative Bloq.