Google Now Hosts Open Source Libraries

by Ostatic Staff - May. 27, 2008

Ajax, a programming/design technique that combines JavaScript, asynchronous HTTP connections, XHTML, and CSS, has turned the Web into a true application platform. Before Ajax, submitting a form or clicking a link meant that the entire HTML page needed to be sent from the server, and then redrawn in the browser. Ajax allows for far more selectivity, such that only one part of a page is updated, leaving the rest untouched.

Ajax works quite well, and has been increasingly popular among many new Web sites. The only problem is the fact that the underlying JavaScript calls needed for Ajax are slightly different on various browsers. A common solution to this problem is to use an open-source Ajax library, such as Prototype, Dojo, or jQuery. Each of these libraries is designed and tested for cross-platform compatibility -- so you can write to the JavaScript API that a library provides, without having to worry about the underlying, browser-dependent details.

The thing is, what if multiple sites are using Prototype 1.6? Because browsers cache files according to their URL, there is no way for your browser to realize that it is downloading the same file multiple times. And thus, if you visit 30 sites that use Prototype, then your browser will download prototype.js 30 times.

Today, Google announced a partial solution to this problem that seems obvious in retrospect: Google is now offering the "Google Ajax Libraries API," which allows sites to download five well-known Ajax libraries (Dojo, Prototype, Scriptaculous, Mootools, and jQuery) from Google. This will only work if many sites decide to use Google's copies of the JavaScript libraries; if only one site does so, then there will be no real speed improvement.

There is, of course, something of a privacy violation here, in that Google will now be able to keep track of which users are entering various non-Google Web pages. That is, if you incorporate Google's version of jQuery into your site, Google will know when someone enters your site, and the various pieces of information (e.g., browser and IP address) that you might want to keep hidden. For those who prefer it, Google is offering the JavaScript files through a function call and API, in addition to a simple "script" tag.

These issues aside, Google's offer does seem to be quite useful for sites and developers alike, reducing memory and bandwidth usage without reducing site flexibility at all. It will be interesting to see how many sites take Google up on their offer, and how positively it will affect users.