Google Hosting Javascript Libraries
Leevi Graham—28th May, 2008 | 2 Comments
I always get a little frustrated when I have to include the same JavaScript library for each and every new project I start—it just seems so messy. Add to that maintaining 20 ExpressionEngine addons (most of which contain some JavaScript) and you have a lot of content duplication, not to mention the possibility of loading the same library many times.
To address this issue, Google has stepped in today to provide designers & developers with a better way of including JavaScript libraries into their pages, which should improve the users' experience. Google will now be hosting many of the popular JavaScript frameworks on their own CDN servers, which can be accessed directly using a url or through their own JavaScript API.
Before you check out the announcement on the Google AJAX Search API Blog, here are some of the instant benefits you can expect:
- Caching can be done correctly, and once, by Google... and developers have to do nothing.
- Gzip works.
- Google will serve minified versions.
- The files are hosted by Google which has a distributed CDN at various points around the world, so the files are "close" to the user.
- The servers are fast.
- By using the same URLs, if a critical mass of applications use the Google infrastructure, when someone comes to your application the file may already be loaded!
- A subtle performance (and security) issue revolves around the headers that you send up and down. Since you are using a special domain (NOTE: not google.com!), no cookies or other verbose headers will be sent up, saving precious bytes.
Personally I will be using the new service (probably direct url links rather than the js api) to improve the speeds of sites we develop at Newism.
If you are interested in speeding up your sites development Yahoo also has an excellent resource dedicated to improving your sites performance including a wonderful Firebug extension called YSlow.

Leave a comment
Commenting is not available in this weblog entry.