Save 25% on Wizard’s SQL for WP w/ code: WIZARDSQL
Web Dev + WordPress + Security

Save Bandwidth by Serving jQuery, MooTools, Prototype via Google’s AJAX Libraries API

A great way to save bandwidth is to take advantage of Google’s AJAX Libraries API to serve your favorite open-source JavaScript libraries. Here is how Google explains it in their official documentation:

The AJAX Libraries API is a content distribution network and loading architecture for the most popular open source JavaScript libraries. By using the google.load() method, your application has high speed, globally available access to a growing list of the most popular JavaScript open source libraries.

The AJAX Libraries API provides your applications with stable, reliable, high speed, globally available access to all of the most popular, open source JavaScript libraries. Your application can use our very flexible loader google.load(), or direct, path based access to the scripts.

Update: Google now lists all of their hosted libraries in one place.


There are two different ways to include JavaScript from Google’s network. The first is to simply link directly to the document via <script> element, just like you would when hosting the file on your own server. For example, to include the most recent (compressed) version of jQuery from Google, we write:

<script src="" type="text/javascript"></script>

The second way to include JavaScript from Google’s network is to use Google’s google.load() method. Google recommends this as the “most powerful way to load the libraries,” offering “the most functionality and performance.” To use this method, you simply name your preferred JavaScript library and desired version number, and include the method at the bottom of your <body> element:

<script type="text/javascript">
	google.load("jquery", "1.2.6");

Here is a complete list of available libraries (current as of 11/25/2008):

google.load("jquery", "1.2.3");
google.load("jqueryui", "1.5.2");
google.load("prototype", "1.6");
google.load("scriptaculous", "1.8.2");
google.load("mootools", "1.2.1");
google.load("dojo", "1.2.0");
google.load("swfobject", "2.1");
google.load("yui", "2.6.0");

Note the syntax used here:

google.load("[name of library]", "[version number]")

Name of library is a no-brainer; the version number is more flexible. The google.load() versioning system enables as much precision as needed. Specifying a full version number (e.g., 1.2.3) will load the exact version; specifying a partial version number (e.g., 1.2) will load the most recent version available for that particular branch. This logic also applies when loading the scripts directly via <script> elements.

Available JavaScript Libraries

Here is a current list (as of the time of this writing) of JavaScript libraries available from Google’s distribution network. All of these libraries are available via either inclusion method (i.e., google.load() or <script>). For more information, or to check out a current list (with current version numbers, etc.), visit Official Developer’s Guide. This list is current as of today, Nov. 25th, 2008:


  • script name: jquery
  • versions: 1.2.3, 1.2.6
  • load request: google.load("jquery", "1.2.6");
  • uncompressed: google.load("jquery", "1.2", {uncompressed:true});
  • script path:
  • uncompressed:
  • script site:
  • note: 1.2.5 and 1.2.4 are not hosted due to their short and unstable lives in the wild..

jQuery UI

  • script name: jqueryui
  • versions: 1.5.2
  • load request: google.load("jqueryui", "1.5.2");
  • uncompressed: google.load("jqueryui", "1.5", {uncompressed:true});
  • script path:
  • uncompressed:
  • script site:
  • note: this library depends on jquery. before loading this module, you must load jquery e.g.:
google.load("jquery", "1.2");
google.load("jqueryui", "1.5.2");


  • script name: prototype
  • versions:,
  • load request: google.load("prototype", "");
  • script path:
  • script site:

  • script name: scriptaculous
  • versions: 1.8.1, 1.8.2
  • load request: google.load("scriptaculous", "1.8.2");
  • script path:
  • script site:
  • note: this library depends on Prototype. before loading this module, you must load Prototype e.g.:
google.load("prototype", "1.6");
google.load("scriptaculous", "1.8.2");


  • script name: mootools
  • versions: 1.11, 1.2.1
  • load request: google.load("mootools", "1.2.1");
  • uncompressed: google.load("mootools", "1.2.1", {uncompressed:true});
  • script path:
  • uncompressed:
  • script site:


  • script name: dojo
  • versions: 1.1.1, 1.2.0
  • load request: google.load("dojo", "1.2.0");
  • uncompressed: google.load("dojo", "1.2.0", {uncompressed:true});
  • script path:
  • uncompressed:
  • script site:


  • script name: swfobject
  • versions: 2.1 (current)
  • load request: google.load("swfobject", "2.1");
  • uncompressed: google.load("swfobject", "2.1", {uncompressed:true});
  • script path:
  • uncompressed:
  • script site:

Yahoo! User Interface Library (YUI)

  • script name: yui
  • versions: 2.6.0
  • load request: google.load("yui", "2.6.0");
  • uncompressed: google.load("yui", "2.6.0", {uncompressed:true});
  • script path:
  • uncompressed:
  • script site:

Taking advantage..?

This is a relatively new service provided by Google. I am interested in whether or not you are taking advantage of it. I have heard reports of many gigabytes of saved bandwidth thanks to Google’s AJAX Libraries API. What about you? Are you planning on using it? Already using it? Share your experience with performance, reliability, bandwidth, or other aspects. It’s fascinating..

Chillz! :)

Jeff Starr
About the Author
Jeff Starr = Web Developer. Security Specialist. WordPress Buff.
Blackhole Pro: Trap bad bots in a virtual black hole.

18 responses to “Save Bandwidth by Serving jQuery, MooTools, Prototype via Google’s AJAX Libraries API”

  1. Avatar photo

    OMIGOSH you just reminded me that I need to check out if it works with Javascript disabled! Aieee! I am very impressed with your Slider script because I like it that it’s completely usable even when the visitor turns off Javascript. Deep inside I thank myself for placing the links at the bottom – for some reason, if I’ve tried to place the links on top, visitors without javascript will have a hard time navigation as the page will position at the top of the anchored container when the the link is clicked. If the links are above, they’ll have to keep scrolling to the top to see the tabs. Phew!

    Have a great December!

  2. Phil E. Drifter 2009/05/08 11:05 am

    #8 Louis: it’s clear from the comment you posted that you have absolutely no idea what you’re talking about and you couldn’t use these services even if you wanted to. Which, thankfully, you don’t.

  3. Avatar photo

    I think it is very interesting to use google for delivering libraries but presently I have the problem that not all functionality is working with mootools from the google network.
    I am not only using the core from mootools I am also using ‘more’.

    Is there any way of combining

    When I use the combination of googles cdn and the ‘more’ from my server, my site doesn’t work properly.

    Any ideas?

  4. Avatar photo

    ill do this, check if you have the right more version, oder check if it works with the 1.2.2 Core from Google:

  5. Avatar photo
    Sebastian 2009/09/02 5:05 am

    @ HeadY
    Besten Dank! It works!

    I am using:
    and I took a new ‘more’ from the mootools ‘more builder’ website.
    Now everything works fine.


  6. Avatar photo

    Don`t like Mootools too :(
    But I love jQuery.
    And your methods is good too.

Comments are closed for this post. Something to add? Let me know.
Perishable Press is operated by Jeff Starr, a professional web developer and book author with two decades of experience. Here you will find posts about web development, WordPress, security, and more »
Wizard’s SQL for WordPress: Over 300+ recipes! Check the Demo »
Daylight savings is a complete waste of time and needs to be eliminated.
Got a couple of snow days here in mid-March. Fortunately it's not sticking.
I handle all email in real time as it comes in, perpetually clear inbox for years now.
Added some nice features to Wutsearch search engine launchpad. Now 21 engines!
.wp TLD plz :)
Nice collection of free SEO APIs and user-agent lookups for Googlebot, Bingbot, Applebot, YandexBot, and more.
90% of online customer support is just explaining how to do basic troubleshooting.
Get news, updates, deals & tips via email.
Email kept private. Easy unsubscribe anytime.