In early 2009, I wrote a post on browser caching times for the Google AJAX Libraries API.
The cheat notes are that three different URLs point to the current edition of jQuery and each URL is cached in the browser for a different length of time:
- Latest in the version 1 tree: 1 hour
- Latest in the version 1.4 tree: 1 hour
- Version 1.4.2 exactly: 1 year
The point of my post was that, when using Google’s AJAX Library to host jQuery, or any of the other libraries, it is best to specify the exact version to receive the full benefit of hosting on the same server as gazillions of other web sites, that being, your visitors don’t need to download the library for every site they visit. I was reminded of this when Dave Ward appeared on episode 32 of the official jQuery podcast.
When jQuery 1.4 was released, the Google URL being publicised by the jQuery team was http://…/jquery/1.4/jquery.min.js – while Google had set it up as http://…/jquery/1.4.0/jquery.min.js. I had two problems with this:
- The publicised URL, coming from the official jQuery team, was only cached for 1 hour;
- Anyone using the publicised URL would automatically be upgraded to jQuery 1.4.1 upon its release, regardless of their expectations.
My request to John Resig and the jQuery team is to avoid confusion by officially numbering the next version as jQuery 1.5.0 and publicising the URL that contains the full version number.
That means that for most people the default version of jQuery they download will be updated least often. It means that the people building the websites have more control over which version of jQuery their end users download and when.
It may seem trivial now but if your visitors leave your site while they’re waiting for jQuery to download, you’ll think it less so.
Update: In the blog post announcing version 1.5, the jQuery team did publicise the 1.5.0 URL on the Google CDN.