Google Hosts JQuery, Scriptaculous, Prototype and Even the Yahoo User Interface Library

For the AJAXians and Web 2.0 citizens amongst you, the wonderful peeps at the Googleplex have done it yet again. Those of you familiar with the concept of NOT reinventing the JavaScript wheel should already be (if not should be) reaping the benefits of the great JavaScript libraries out there. My personal weapon of choice is JQuery (for which you can even get intellisense for in VS2008 these days, check out Scott Gu's blog even if you are not interested in JQuery intellisense, it’s probably the best ASP.NET blog out there).

Anyway, I digress, one of the problems with these libraries is that they often change frequently and while we all try to keep on top of the changes and new builds even the best of us can miss one. Not only that, having to host the libraries in your projects and then changing code to support a new release can mean that users may still have cached versions of the old JavaScript files stuck in their temporary internet files causing JavaScript errors and in the worst case rendering your AJAX masterpieces unusable.

Enter the Google AJAX Library API
The guys at Google have reached out to the major stakeholders in these libraries and are now hosting the different builds of the Libraries for direct loading from google servers. They have committed to maintaining the older versions of these libraries too so there is no chance you can find yourself a couple of JavaScript files less than an application (nice nerdy euphemism there). The cache headers are also set correctly, so this means that you will not have any cached JavaScript issues either.

Setting it all up
Setting it up couldn’t be simpler:

<script src=""></script>
// Load jQuery
google.load("jquery", "1");

Yes that really is it! For the performance connoisseurs out there, you can choose to add this at the end of your page so the scripts load last (provided nothing is required in the page load).

Plus you can add as many libraries as you like using google.Load (go for it load the whole lot!)

<script src=""></script>
google.load("jquery", "1.3.0");
google.load("jqueryui", "1.5.3");
google.load("prototype", "");
google.load("scriptaculous", "1.8.2");
google.load("mootools", "1.2.1");
google.load("dojo", "1.2.3");
google.load("swfobject", "2.1");
google.load("yui", "2.6.0");

For more information see the complete API documentation at google:

Google AJAX Libraries API

Happy scripting!

kick it on