The Google AJAX Libraries API is a content distribution network and loading architecture for popular open source JavaScript libraries.
At its simplest, you can reference Google's hosted version of libraries like jQuery. One benefit is performance thanks to shared caching - if your user has already been to a site with a Google hosted library, the library is already in their browser's cache and they won't need to reload it.
Another is a simpler way to keep your site up-to-date with the latest version of the library. For example, include a script reference to this:
http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js
to include jQUery 1.2.6. But include a reference to this:
http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js
and Google will always send you the latest 1.x version of jQuery. One drawback to this flexibility is that for the caching to work, previous sites must reference the library the same way that you do.
It gets even more powerful by allowing you to dynamically loaded libraries. Instead of loading jQuery immediately when your page loads, wait until you really need it and then call a function like this:
google.load("jquery", "1.2.3");
to load it only when you need it.
Right now the supported libraries include jQuery, prototype, script.aculo.us, mootools and dojo. Perhaps we'll soon see Ext.JS?
Thursday, July 17, 2008
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment