google.load(): Utilize Google’s AJAX Libraries API
The answer: Google AJAX Libraries APIs. Google hosts these frequently used files, including the newest versions (and legacy versions) of jQuery MooTools, YUI, Dojo, Prototype, and more. Why use Google's AJAX Libraries API? Benefits include:
- Google's servers can serve the file faster than your shared hosting server.
- Since the file is always being pulled from the same place, the more sites that use that file, the more likely that file is already in the user's cache. Thus, your website loads faster.
- You save bandwidth.
Here's how you implement google.load().
//get the latest moo google.load('mootools', '1.2.1'); //other examples google.load('jquery', '1.3.1'); google.load('jqueryui', '1.5.3'); google.load('prototype', '22.214.171.124'); google.load('scriptaculous', '1.8.2'); google.load('mootools', '1.2.1'); google.load('dojo', '1.2.3'); google.load('swfobject', '2.1'); google.load('yui', '2.6.0');
That's all there is to it. Pass Google the library and version you desire and Google does the rest.