Web Design Company

Back to articles list

The Pros and Cons of Javascript

Javascript use is very common across the Internet; but just because it is popular, does that mean you should use it for your site? What can be achieved from using it? When should you use it? At present, Javascript is probably the most misused programming language in the world.

Javascript is used to write small programs into web pages to achieve functions not possible using normal HTML. It is a browser-side programming language, which means that the programming code executes through your browser after the page has been downloaded from a web server. Browser-side programming languages allow events to occur on a page without it having to reload, so you can, for example, validate several form inputs to see if they have been completed without a user having reload the page to tell them to fill in a missing field.

Other than form validation, common uses for Javascript include rollover buttons, opening new windows and drop down navigation menus. Javascript is often inserted into a web page to achieve effects like rollovers when using a web design program such as Macromedia Dreamweaver. It is a fact though that Javascript is not needed to perform these functions. Rollovers and drop down menus can be achieved using CSS, with quicker download times than if done using Javascript. Server-side scripting languages, whilst having to reload a page, have functions built into their language to validate form data more thoroughly and effectively.

A major issue regarding the use of drop down menus and other forms of navigation using Javascript is that search engines cannot see them, and so cannot access other pages within a website (see my article on Search Engine Optimisation coming soon). When trying to get your site to the top of the search engine results, this is a huge negative step.

Javascript is often typically used where it is completely unneccessary, such as for embedding media data into a web page, which can be done through HTML.

Finally, though perhaps most importantly, many web users now have Javsacript turned off in their browser. This is because Javascript is commonly used for adverts, pop-up windows and other annoyances. If your site cannot operate without Javascript, it cannot be seen by these users. Do you really want to cut out an increasingly large percentage of your audience due to unnecessary scripts on your pages?

After all these negative points, you may be asking yourself, are there any positives to using Javascript? I don't honestly believe there really are. Other than the browser-side language advantages, I have very rarely seen Javascript additions to a web site that either CSS or a server side programming language cannot achieve. The vast majority of Javscript website add-ons are pointless and do not enhance it in any way.

When coding using Javascript you need to ask yourself one simple question - is it worth doing all this coding work when a user may have Javascript turned off in their browser, and render all my work obsolete?

By John Ulotti