Google AJAX Library CDN Versioning

It’s amazing what you find when you read the documentation. Since I always forget the address for Google’s CDN hosting of jQuery I have to search for it each time. This time when I found the address I was looking around a bit and found out this interesting tidbit that I didn’t know before about Google’s CDN for their AJAX libraries.

Specifying a version of “1.8.2″ will select the obvious version. This is because a fully specified version was used. Specifying a version of “1.8″ would select version 1.8.4 since this is the highest versioned release in the 1.8 branch. For much the same reason, a request for “1″ will end up loading version 1.9.1.

Google AJAX Libraries API Developer’s Guide

For example, if I were linking to jQuery I would normally have used the following and updated semi-regularly:

http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js

But if I just want the latest for the “1.3″ version I could reference:

http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js

Or if I was feeling really risky and trust jQuery not to break between versions:

http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js

Hope its as useful to others as I found it!

Comments

2 Comments so far. Leave a comment below.
  1. Jean,

    But remember that google will use different Expire Headers.

    I think Version 1.3.2 is valid for one year and Version 1 only for a day.

  2. Lars,

    Use your own deployment of query. makes your projects more self-reliant

Add Your Comments

Disclaimer
Your email is never published nor shared.
Required
Required
Tips

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <ol> <ul> <li> <strong>

Ready?