JavaScriptNews

Too much JavaScript

Most design agencies use JavaScript for every project, says Line’s senior developer, Alistair Burns, and a lot of clients are perfectly happy with this. But how many consider users who can’t run it, such as government departments, public sector organisations and people with disabilities?

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  (www.w3schools.com/browsers/browsers_stats.asp), 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.

Log in to Creative Bloq with your preferred social network to comment

OR

Log in with your Creative Bloq account

site stat collection