Using the service is simple. You can directly reference the libraries via URI like so:
Alternatively, you can use Google’s API thusly:
The first argument is the name of the library and the second is the desired version.
184.108.40.206. But you can specify any increment level and it will serve up the latest version. For example if you specify version
1.6 you’ll get the latest
1.6 incremental version, what ever that may be. The same happens if you specify version
1, and if you don’t specify any version you’ll get the latest version available.
However, I noticed something even niftier when doing some testing, the
Cache-Control header value is adjusted to suit the request. When specifying a specific incremental version, the header value looks like this:
Cache-Control: public, max-age=31536000
This informs any caching mechanism that cares to honor Cache-Control headers that the content is safe to cache for up to a year. When a more general version is specified you get this:
Cache-Control: public, max-age=3600, must-revalidate, proxy-revalidate
This informs caches that the content should be checked for changes hourly, to ensure the latest version is delivered.
The documentation only mentions versioning in association with the
google.load API call but all the following direct URIs seem to work and deliver Prototype 220.127.116.11:
Currently Google hosts:
Some of those libraries also have minified versions.
When announcing the API on Ajaxian, Don also said something very interesting about the future of this kind of service:
If we see good usage, we can work with browser vendors to automatically ship these libraries. Then, if they see the URLs that we use, they could auto load the libraries, even special JIT’d ones, from their local system. Thus, no network hit at all!
addEvent method; so much wasteful duplication of code. The availability of common frameworks has stopped the duplication and offers a useful level of abstraction. I think Google’s new service is a great step in the right direction.