Wednesday, May 13, 2009

Google Hosted JQuery

Roughly a year back, Google announced that it would host widely used open source JavaScript Libraries on their Content Distribution Network - jQuery, Prototype, Script.aculo.us, MooTools to name a few. Google suggests the use of their Google AJAX API Loader's google.load() method to gain application speed.

How to use in ASP.Net Application?

This is how the JQuery library could be loaded using Google AJAX API Loader's google.load() method.





There are certainly some benefits using Google's CDN
Caching
Decreased Latency
Convenience


Caching - Better speed
The main advantage of using Google's CDN is they manage all the bug fixes, recent updates and provide a high speed access due to better caching, etc. The simple idea behind this is speed - the user's browser does not have to download multiple copies of JS libraries from different public facing websites.

Decreased latency
Certainly, you could make use of Google's distributed servers to download the JS files from a server located physically close to you.

Convenience
Google takes out the pain of staying upto date with the source code, bug fixes, minifying and version changes.

However, there are certain things that a developer needs to be aware of before taking the road of Google CDN.
  1. What if Google goes down? Will your code be prepared to handle something like this. Well, if you will take care of it, you are all set!
  2. There will be a performance speedup only when the user happens to have those libraries loaded from some other site that uses google’s service


0 comments: