Google and Yahoo JavaScript CDN

One way to speed up loading of a website is to use Content Distribution Networks (CDN) for resources that don’t update often, such as JavaScript, images, and CSS. A good CDNs for a large site can run into the thousands of dollars, fortunately for those that rely on JavaScript frameworks such as jQuery, Prototype, and YUI you can use the use Google’s and Yahoo’s broadband.

Google hosts a large number of JavaScript libraries, including jQuery, jQuery UI, Prototype, Dojo, and even YUI! Using the JavaScript libraries hosted on Google should make your page load faster. Google give you an absolute URL address for each version of the JavaScript library you are trying to use, this makes it easy to load the required scripts.

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

Yahoo also provides free hosting of the Yahoo! User Interface from their servers.

One theory why using Google hosting for jQuery and similar hosted JavaScript frameworks is that if many of the sites you visit use them, your browser will already have a fresh cached version ready for you. My question is, why don’t browsers come pre-installed with the commonly used versions of JavaScript libraries? Odiously, if this feature would be enabled from the top tier browsers there would also need to implement a discovery mechanism to download into a browser repository new versions of those JavaScript libraries. A code discovery, management, and repository system that I have seen work well is that provided by Maven. In Maven, you can indicate a number of online and local code repositories from which to download required dependencies.