Sunday, August 01, 2010

Website Performance: Hosted JavaScript Libraries

Most web applications these days make use of Libraries like jQuery.

These libraries offer significant advantages, but increase the initial page load time to a certain extent.

Most popular libraries are widely hosted by companies like Google and Microsoft. Instead of hosting these libraries yourself, it is feasible to include these libraries from such common locations.

When using the common location, chances are that the Browser has already cached the same URL and need not re-fetch the library for your site.

All in all, it's a win-win situation for you:
1) Saves bandwidth as you need not refer to your hosted library. In some cases this may save you some money.
2) Page loads faster as browsers might already have the libraries cached.

Google Libraries API provides a wrapper around the well known and widely used libraries (jQuery, Dojo, prototype, YUI etc.). Once included, you can directly load any popular library with a simple function call (example: google.load("jquery", "1.4.2"))

No comments: