Google Hosted JS libraries

Google launched a new project under Google Code where they are hosting the 5 popular javascript libraries for anyone to include in their site.  The thinking is that by having a bunch of websites link against a common location for their javascript libraries the user’s browser can cache it once and use the cached copy, reducing page load time.

You can load the library through Google’s AJAX API loader, or link to it directly through the <script/> tag.  For starters, they’re hosting jQuery, prototyle, script.aculo.us, MooTools, and dojo.

Sounds like this could be useful, but only if a lot of people buy into it.

http://code.google.com/apis/ajaxlibs/

3 Responses to “Google Hosted JS libraries”

  1. JLG says:

    Why do you say many people need to buy into it? I guess because you want the user to have incurred the cost to cache the copy on somebody ELSE’s site to make mine look faster?

    What does this mean for version control? What do you think google sets for the cache timeout?

  2. jwong says:

    Google keeps multiple versions of a library around. The URL to the JS file contains the version or you can specify the version in their loader script. (ie. http://ajax.googleapis.com/ajax/libs/jquery/1.2.3/jquery.min.js)

    Looks like the cache timeout is one year.

    Last-Modified: Sat, 24 May 2008 00:39:29 GMT
    Content-Type: application/x-javascript
    Expires: Thu, 28 May 2009 22:15:12 GMT
    Date: Wed, 28 May 2008 22:15:12 GMT
    Cache-Control: public, max-age=31536000
    Content-Encoding: gzip
    Transfer-Encoding: chunked
    Server: GFE/1.3

  3. Matt C. says:

    According to the people at the conference, Google has pledged to keep all old versions of the libraries available. So “in ten years,” when “jQuery might not even have 1.2.3 available on their website,” Google will still have 1.2.3.

Leave a Reply