pic of alistair burns

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.

25 comments

Comment: 1

What is necessary is that every website should be built around a core experience accessible without js and accessible to web crawlers. Then on top of that all the js experience shall be built. Those who have js disabled can still access the content. All the others will also have the 'social' or advanced experience

Comment: 2

For years now I thought we'd all (?) being building site using progressive enhancement or sometimes graceful degradation, but I was really beginning to wonder whether these practices were still relevant. With websites becoming more like online apps (the ol RIA) it's increasingly difficult to create a true HTML only version.

A simple multistage form served over AJAX is OK but a complex set of interactions offloaded to the browser doubles the work if this has to also be built server side as well. This also requires skillsets front and backend. This is a hard sell to clients to increase the cost of build by 10-20% for 1% extra market share. As you say if it's important to the clients audience then the market share will be higher.

Comment: 3

It is always nice to read articles which extol the virtues of creating a site which is not wholly reliant on Javascript.

Personally, despite the opinions of my peers, I always build all of my sites to function without client-side scripting and then utilise progressive enhancement to offer a richer experience for those who do not have locked-down or antiquated software.

The main reason for this is that my first job as a web editor was within a company whose IT department locked down absolutely everything and would not migrate from IE6, such that my browsing experience was severely hampered. It is always in the back of my mind whenever I work on a project.

It still amazes me how many people forget that Javascript is not entirely ubiquitous, especially in regard to using Javascript for effects which can easily be achieved using pure CSS; I cite content-heavy drop-down menus within many large websites as an example. If Javascript is turned off, a large section of the site is difficult or nigh on impossible to access as the navigation does not function. The same effect could easily be achieved through the use of the :hover pseudo-class as opposed to client-side scripting.

Comment: 4

Since I have started using more and more Javascript the sites I build are becoming more and more complex. I realize selling a website to a client using Javascript there is a need to build it in a way that the Javascript will degrade gracefully when turned off. If you use Ajax to submit a form, you need the form to work with it shut off as well.

Most developers do not take this approach. I find it in competitors websites on a daily basis. You have no idea how badly crippled some websites become with JS turned off.

Browsers are becoming advanced quickly, but sadly their are still too many older browsers still in use. With all of the JS and CSS differences it virtually makes fast development impossible. At some point you just have to discontinue support for older browsers.

I think in many ways I wish I never started using JS.

Comment: 5

That's why there is something called 'progressive enhancement' every good web developer should know about that design philosophy.

Comment: 6

The message at the top of this page reads:
"Enable Javascript to get the most out of our site"

That's not ironic at all! :o)

Comment: 7

The problem with Javascript is not to put too much, is that it's needed to have your code well organized and it's not needed to load all the Javascript at the same time!

The first to code your Javascript is to develop it using OOP.

If you make this you can use different design patterns that allows you to divide better your code.

After this you must make an analysis of what is really, really important and necessary to be loaded with the page, and what can be loaded in asynchronous mode or being deferred to the actions of the user.

In my company following this steps we reduce the time from 6 secons of load to less than 2 seconds.

We have a modular environment created using the Hydra.js(http://tcorral.github.com/Hydra.js/) that allows to divide the code by funcionality.

Test it, and send your feedback.

Comment: 8

Using W3Schools as a reference does not convey experience in this subject. Too much JavaScript is like saying "it's too interactive". It's subjective at best. Cars don't need radios either.

JavaScript can enhance disability issues with better tabbing and arrow navigation. It can also make use of WAI roles.

There's a lot of talk in the post and in the comments about old browsers. Old browsers had JavaScript. That's a compatibility issue, and has nothing to do with the age of a browser. If your target audience is a government agency with JavaScript turned off, then you will know that upfront and obviously won't be building an Ajax-heavy app.

So you're pretty much left with people who turn off JavaScript because they don't like all that "Ajax-y" stuff and it helps block ads. That will be less than 1% of your audience. Your resources would probably be better spent targeting IE3 and Firefox 1 than these people.

Comment: 9

Users who "can't" or "won't"... I say get with the program USERS!

Comment: 10

yopaisan - you obviously are not a business owner nor are you responsible for attracting clientele. Try staying in business with that "It's your problem not mine" attitude.

Comment: 11

Agreed, but in my experience, you know up front if the audience for your app is on a specific browser with limitations or if they will have JavaScript turned off.

Comment: 12

I use the NoScript FF add-on to surf the web and it is just wonderful to load pages faster and also read pages without all the blinking and flashing advertising banners. It is also amazing how many web sites out there are simply not working and cannot be viewed without javascript--or flash.

Comment: 13

Same as Adrian I am also a vivid supporter of the NoScript add-on. Having been using it for a long time now I can clearly say that I like those sites most that have

a) a clear and minimal layout
b) solid content
c) as little as possible advertising
d) display completely and correct with NoScript turned on

There are quite a few such sites online I find but immediately when I come across such a site I feel so released that some people actually understand that "less is more". Honestly if you think you have a full on flash and js loaded site to impress your viewers you are actually turning them away. Most first time visitors of a site will leave if the site does not load within 1-3 seconds. Do not forget that visitors come to your site searching for content and not for your web design magic skills.

Side note about w3schools: Check out http://w3fools.com/ Taking stats from w3s is OK I guess.

Comment: 14

I like Javascript, but don't use it at all in my site design. I find minimal design coupled with usability rather than ego stroking creates a much more interesting evolution in my design ethic. I even use good old Perl rather than the latest tech because it does the job, is fast, and is damned cheap for my clients to get hosted.

Comment: 15

Using W3Schools as a reference does not convey experience in this subject. Too much JavaScript is like saying "it's too interactive". It's subjective at best. Cars don't need radios either.

e-commerce online store web design

Comment: 16

Old browsers had JavaScript. That's a compatibility issue, and has nothing to do with the age of a browser. If your target audience is a government agency with JavaScript turned off, then you will know that upfront and obviously won't be building an Ajax-heavy app. ビーグレン

Comment: 17

The web design has a fairly recent history, it can be linked to other areas such as graphic design. However web design is also seen as a technological standpoint. It has become a large part of people’s everyday lives. It is hard to imagine the Internet without animated graphics, different styles of typography, background and music. Thanks.
Regards,
Scottsdale real estate Arizona

Comment: 18

Java is considered a general purpose programming language and has various features like multiple inheritance and operator overloading. These provide help in running small applications such as java applets that can be downloaded from a Web server and run over the World Wide Web through java compatible web browsers. Thanks a lot.
Regards,
Essay writing UK

Comment: 19

I find minimal design coupled with usability rather than ego stroking creates a much more interesting evolution in my design ethic.Real Estate Website I even use good old Perl rather than the latest tech because it does the job, is fast, and is damned cheap for my clients to get hosted.

Comment: 20

I have got some useful information from this site. Thanks for this type of blog. Want you will continue to post same in future.
seo article writing

Comment: 21

I like the valuable information you provide in your articles. I will bookmark your weblog and check again here frequently. I’m quite sure I will learn lots of new stuff right here! Good luck for the next!
seo article writing

Comment: 22

This is really satisfied by the great info is visible in this blog that to very much information in this blog. Thanks a lot for providing the great info is visible in this blog
Cell phone spy

Comment: 23

This is really satisfied by the great info is visible in this blog that to very much information in this blog. Thanks a lot for providing the great info is visible in this blog
Cell phone spy

Comment: 24

Having been using it for a long time now I can clearly say that I like those sites most that have Same as Adrian I am also a vivid supporter of the NoScript add-on. Web Design

Comment: 25

This is my first time I visited this web site. I came across plenty of exciting information inside your blog site. By the lots of commentary on your articles, I assume I am not the only person that loves your posts.
Clubmz reviews
June issue on sale now!

The Week in Web Design

Sign up to our 'Week in Web Design' newsletter!

Hosting Directory
.net digital edition
Treat yourself to our geeky merchandise!

site stat collection