Neil Turner's Blog

Blogging about technology and randomness since 2002

The fall and rise of JavaScript

Duck and penguin

These days, JavaScript is everywhere. Just about every modern web site uses it to some extent, with some like Google Docs effectively building entire applications on it.

But it wasn’t always this way.

The beginning

JavaScript was invented by Brendan Eich, the former CEO of Mozilla, whilst he was at Netscape. It first shipped with version 2.0 of Netscape Navigator in 1995. Originally called LiveScript, it was re-named after Java, the language developed by Sun Microsystems (now Oracle), but bore no resemblance to it. Whilst both can run in a web browser, Java uses a plugin whereas JavaScript is built-in.

Microsoft supported JavaScript in Internet Explorer 3.0, released in 1996, but also tried to promote its own VBScript language, based on VisualBASIC. VBScript never took off and I’m not sure if newer versions of IE even support it.

Pop-ups and pop-ups and pop-ups, oh my!

Let’s go forward a few years to June 2004. Internet Explorer 6 dominated the web browser scene, and the release of Firefox 1.0 was still some months away. IE6 didn’t come with a popup blocker – so unless you had installed a third-party one, web browsing was often not a fun experience. And it was JavaScript to blame – at the time, I seem to recall that around 10% of all web users turned JavaScript off altogether.

We were also discouraged from using JavaScript for accessibility reasons. Screen readers, which converted web pages into braille or speech, usually couldn’t understand JavaScript, and nor could the various robots used by search engines.

In any case, all that JavaScript was used for, apart from popups, was for changing the text in the browser status bar, or animation effects. These tended to be relegated to personal home pages on Geocities, with the big, professional sites sticking to plain HTML.

The AJAX revolution

2004 was the year when things started to change. The engineers at Flickr had found a little-used feature in JavaScript called XMLHTTPRequest, which could be used to update parts of a web page from the server without having to re-load the entire page, as before. It had been added to Internet Explorer 5.0 by Microsoft, and then adopted by Mozilla in its web browser – Safari and other browsers followed and it became a de facto standard despite not being a formal part of the JavaScript language.

This became known as AJAX – Asynchronous JavaScript and XML – and its usage took off. Not needing to reload full pages when only parts needed updating meant a faster experience for the user, and reduced the load on web site servers. Consequently, use of AJAX grew quickly, and JavaScript started to become acceptable again.

Improving JavaScript Performance

As more and more web sites started employing ever more complex JavaScript code, performance started to become an issue. Unlike regular software programs, where source code is compiled into machine code and then distributed, JavaScript is a scripting language and so the source code is compiled as it is run. Complex code was starting to slow down web browsing.

Thankfully, over time, web browsers have improved their JavaScript engines. Firefox has IonMonkey, Safari has Nitro (although it was originally called ‘Squirrelfish Extreme’), Chrome has V8 and Internet Explorer presumably has something else. This means it’s possible to do much more in the web browser – for example, the recently mentioned uses a JavaScript library to encrypt and decrypt cypher-text.

Taking out Flash

Another major milestone in JavaScript adoption came in 2007, with Apple’s announcement of the iPhone. The iPhone was the first to ship with a fully-featured web browser, and crucially it had full support for JavaScript. The App Store didn’t exist until a year later, so in the early days all third-party apps had to be web apps. JavaScript made some of these possible.

But another iPhone design decision also helped to fuel JavaScript adoption: the absence of Adobe Flash Player. Most desktop users have Flash installed and so many web sites made use of it, but its performance on mobile devices has always been poor, especially when it comes to battery life. As increasing numbers of users browse the web using phones and tablets without Flash support, web sites have had to move to JavaScript for their interactive content. Adobe have now discontinued their Flash player for Android devices.

Beyond the browser

Recently JavaScript has made the jump from being a way of enhancing web pages to being a complete scripting language, like Perl or Python. The open source project node.js allows JavaScript applications to be run from the command line. And in the next version of Mac OS X, inter-application scripting will be possible using JavaScript, as well as Apple’s own AppleScript which has been around for many years.

From humble beginnings, to being the scourge of the web, to being present on just about every web site, JavaScript has had a very interesting history. The things it is capable of now would have surprised many only a decade ago, when ‘JavaScript’ was almost a dirty word. It’s long surpassed its namesake Java, which is now the disliked, slow, security bug-ridden bane of many users. Whilst Java will live on as the programming language for Android phones, very few web sites use it nowadays, whereas JavaScript is just about everywhere.

It’s also a triumph of an open scripting language against the proprietary nature of Adobe Flash. Flash can only support the platforms that it is built for, whereas JavaScript can run on just about anything – a Raspberry Pi, your smartphone, web servers, or your regular desktop computer. For people like me who have been on the web for a long time, it’s an amazing turnaround for what was once an annoyance.

One Comment

  1. JS made a surprise comeback but is also the main reason why websites are really slow these days even with the new JS engines. A good example is