Chapter 6. Historical JavaScript Milestones
Table of contents
Buy the book
(Ad, please don’t block.)

Chapter 6. Historical JavaScript Milestones

It took JavaScript a long time to make an impact. Many JavaScript-related technologies existed for a while until they were discovered by the mainstream. This section describes what happened from JavaScript’s creation until today. Throughout, only the most popular projects are mentioned and many are ignored, even if they were first. For example, the Dojo Toolkit is listed, but there is also the lesser-known qooxdoo, which was created around the same time. And Node.js is listed, even though Jaxer existed before it:

1997—Dynamic HTML
Dynamic HTML allows you to dynamically change the content and appearance of a web page. You achieve this by manipulating the Document Object Model (DOM) of the page, a tree-shaped data structure. Things you can do include changing content, changing style, and showing and hiding elements. Dynamic HTML appeared first in Internet Explorer 4 and in Netscape Navigator 4.
1999—XMLHttpRequest
This API lets a client-side script send an HTTP or HTTPS request to a server and get back data, usually in a text format (XML, HTML, JSON). It was introduced in Internet Explorer 5.
2001—JSON, a JavaScript-based data exchange format

In 2001, Douglas Crockford named and documented JSON (JavaScript Object Notation), whose main idea is to use JavaScript syntax to store data in text format. JSON uses JavaScript literals for objects, arrays, strings, numbers, and booleans to represent structured data. For example:

{
    "first": "Jane",
    "last": "Porter",
    "married": true,
    "born": 1890,
    "friends": [ "Tarzan", "Cheeta" ]
}

Over the years, JSON has become a popular lightweight alternative to XML, especially when structured data is to be represented and not markup. Naturally, JSON is easy to consume via JavaScript (see Chapter 22).

2004—Dojo Toolkit, a framework for programming JavaScript in the large
The Dojo Toolkit facilitates programming in the large by providing the necessary infrastructure: an inheritance library, a module system, an API for desktop-style graphical widgets, and more.
2005—Ajax, browser-based desktop-class applications

Ajax is a collection of technologies that brings a level of interactivity to web pages that rivals that of desktop applications. One impressive example of what can be achieved via Ajax was introduced in February 2005: Google Maps. This application allowed you to pan and zoom over a map of the world, but only the content that was currently visible was downloaded to the browser. After Google Maps came out, Jesse James Garrett noticed that it shared certain traits with other interactive websites. He called these traits Ajax, a shorthand for Asynchronous JavaScript and XML.[7] The two cornerstones of Ajax are loading content asynchronously in the background (via XMLHttpRequest) and dynamically updating the current page with the results (via dynamic HTML). That was a considerable usability improvement from always performing complete page reloads.

Ajax marked the mainstream breakthrough of JavaScript and dynamic web applications. It is interesting to note how long that took—at that point, the Ajax ingredients had been available for years. Since the inception of Ajax, other data formats have become popular (JSON instead of XML), other protocols are used (e.g., Web Sockets in addition to HTTP), and bidirectional communication is possible. But the basic techniques are still the same. However, the term Ajax is used much less these days and has mostly been replaced by the more comprehensive terms HTML5 and Web Platform (which both mean JavaScript plus browser APIs).

2005—Apache CouchDB, a JavaScript-centric database
Roughly, CouchDB is a JSON database: you feed it JSON objects, without the need to specify a schema in advance. Additionally, you can define views and indexes via JavaScript functions that perform map/reduce operations. Hence, CouchDB is a very good fit for JavaScript because you can work directly with native data. Compared to a relational database, there is no mapping-related impedance mismatch. Compared to an object database, you avoid many complications because only data is stored, not behavior. CouchDB is just one of several similar NoSQL databases. Most of them have excellent JavaScript support.
2006—jQuery, helping with DOM manipulation
The browser DOM is one of the most painful parts of client-side web development. jQuery made DOM manipulation fun by abstracting over browser differences and by providing a powerful fluent-style API for querying and modifying the DOM.
2007—WebKit, taking the mobile web mainstream
Based on prior work by KDE, WebKit is an HTML engine that was introduced by Apple in 2003. It was open-sourced in 2005. With the introduction of the iPhone in 2007, the mobile Web suddenly became mainstream and had little to no limitations compared to the nonmobile Web.
2008—V8, proving JavaScript can be fast
When Google introduced its Chrome web browser, one of its highlights was a fast JavaScript engine called V8. It changed the perception of JavaScript as being slow and led to a speed race with other browser vendors from which we are still profiting. V8 is open source and can be used as a standalone component whenever you need a fast embedded language that is widely known.
2009—Node.js, implementing JavaScript on the server

Node.js lets you implement servers that perform well under load. To do so, it uses event-driven, nonblocking I/O and JavaScript (via V8). Node.js creator Ryan Dahl mentions the following reasons for choosing JavaScript:

  • “Because it’s bare and does not come with I/O APIs.” [Node.js can thus introduce its own nonblocking APIs.]
  • “Web developers use it already.” [JavaScript is a widely known language, especially in a web context.]
  • “DOM API is event-based. Everyone is already used to running without threads and on an event loop.” [Developers are used to an asynchronous coding style.]

Dahl was able to build on prior work on event-driven servers and server-side JavaScript (mainly the CommonJS project).

The appeal of Node.js for JavaScript programmers goes beyond being able to program in a familiar language; you get to use the same language on both client and server. That means you can share more code (e.g., for validating data) and use techniques such as isomorphic JavaScript. Isomorphic JavaScript is about assembling web pages on either client or server, with numerous benefits: pages can be rendered on the server for faster initial display, SEO, and running on browsers that either don’t support JavaScript or a version that is too old. But they can also be updated on the client, resulting in a more responsive user interface.

2009—PhoneGap, writing native apps in HTML5
PhoneGap was created by a company called Nitobi that was later purchased by Adobe. The open source foundation of PhoneGap is called Cordova. The initial mission of PhoneGap was to make it possible to implement native mobile apps via HTML5. Since then, support has expanded to nonmobile operating systems. Currently supported platforms include Android, Bada, BlackBerry, Firefox OS, iOS, Mac OS X, Tizen, Ubuntu, Windows (desktop), and Windows Phone. Apart from HTML5 APIs, there are also PhoneGap-specific APIs for accessing native features such as the accelerometer, camera, and contacts.
2009—Chrome OS, making the browser the operating system

With Chrome OS, the web platform is the native platform. This approach has several advantages:

  • It is much easier to create an operating system, because all of the user interface technology is already there.
  • Many developers already (mostly) know how to write apps for the operating system.
  • Managing apps is simple. That helps public installations such as Internet cafes and schools.

The introduction of the mobile operating system webOS (which originated at Palm and is now owned by LG Electronics) predates the introduction of Chrome OS, but the “browser as OS” idea is more apparent with the latter (which is why it was chosen as a milestone). webOS is both less and more. Less, because it is very focused on cell phones and tablets. More, because it has Node.js built in, to let you implement services in JavaScript. A more recent entry in the web operating system category is Mozilla’s Firefox OS, which targets cell phones and tablets. Mozilla’s wiki mentions a benefit of web operating systems for the Web:

We also need a hill to take, in order to scope and focus our efforts. Recently we saw the pdf.js project [which renders PDFs via HTML5, without plugins] expose small gaps that needed filling in order for “HTML5” to be a superset of PDF. We want to take a bigger step now, and find the gaps that keep web developers from being able to build apps that are—in every way—the equals of native apps built for the iPhone, Android, and WP7.

2011—Windows 8, first-class HTML5 apps
When Microsoft introduced Windows 8, it surprised everyone with the operating system’s extensive integration of HTML5. HTML5 applications are first-class citizens in Windows 8, on par with those implemented via incumbent technologies such as .NET and C++. To demonstrate that point, Microsoft wrote several important Windows 8 applications in HTML5 (plus calls to native APIs), including the app store and the email app.


[7] Ajax is a shorthand, but not an acronym, which is why it isn’t styled as AJAX.

Next: III. JavaScript in Depth