Did you know Google hosts various JavaScript library for you? They currently support:

Just looking at November stats for this blog ShoeMoney.com you can see we have used over 6 gigabytes of bandwidth calling the jquery JavaScript library:

Now honestly I don’t care about the bandwidth savings… my bill is the same if I did not use this but I do care about security and I am much more inclined to believe Google will have a up to date, secure version hosted then the one that wordpress installs (and I forgot to update).

I wonder why WordPress does not use the Google hosted JavaScript libraries by default. Its one less thing they would have to worry about in regards to version, security, and bandwidth for its users.

From the official Google Ajax Libraries API site:

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

And here is a movie from their developers on youtube:

Good stuff Google!

By Jeremy Schoemaker

Jeremy "ShoeMoney" Schoemaker is the founder & CEO of ShoeMoney Media Group, and to date has sold 6 companies and done over 10 million in affiliate revenue. In 2013 Jeremy released his #1 International Best selling Autobiography titled "Nothing's Changed But My Change" - The ShoeMoney Story. You can read more about Jeremy on his wikipedia page here.

57 thoughts on “Google Ajax Libraries API & How To Save On Your WordPress Bandwidth”
  1. WordPress and Google are rivals. Google supports blogger and recently bought a South Korean Internet company (I don’t remember the name now) in order to compete with WordPress. Maybe that’s why WordPress doesn’t want to use Google services as well! 😉

    1. WordPress already uses a lot of Google Features some even much more immature. (like google gears)

      1. I think gears is the only feature that wordpress is actually using.
        And this is totally different then gears.

    1. @Shoemoney

      Thanks a ton, this is exactly why I subscribe to this blog. This is a great thing. I’m always looking for ways to increase performance, and this is exactly the kind of thing that helps me.


      Thanks for the tip. That just extends the coolness of how useful this post is.

  2. That would save a lot of bandwidth for small shared hosting.
    Thanks for sharing.. will do the changes. 🙂

  3. Very useful tip, I’d imagine that Google’s servers are probably more robust than the ones my host are!

  4. I have wondered this as well when I heard about Google hosting the AJAX libraries. Not only would it save on bandwidth, the files would get cached by the browsers and any site using the Google hosted libraries would load much faster.

    1. The idea seems nice. Having it done by google not so nice. People tend to move everything to google and that’s just a bad idea. One big corporation controlling all of your assets is really bad. The web, internet and “everything else” work so well because they are distributed so keep them like that people, don’t do things you might regret for a few megs of bw savings.
      Sure on shoemoney.com that’s almost 6Gb but it’s still just 2.77% of the total bw savings. I think the percents matter more.

    2. The caching is probably the most important reason why you should use googles (or yahoos) hosted JS libraries. Once a user access a site that uses one of those hosted libraries, they will never need to load them again, regardless which site they access.

      I disagree with the security reason Jeremy gave, because you have a directory for each version you want to load on the google servers. So if there’s an update of the library you need to manually switch to the new version.

    3. Agreed about faster. Using flikr for graphics, google for ads, my pages load much quicker, plus the bandwidth savings.

      1. I thought that Flickr charges a fee if you want a certain amount of pictures uploaded?

  5. […] of article marketing. You will find articles detailing various products or discussing various Google Ajax Libraries API & How To Save On Your WordPress Bandwidth – shoemoney.com 12/28/2008 Did you know Google hosts various JavaScript library for you? They […]

  6. Muy bueno el articulo, me gusto y esta muy clarito las librerias de AJAX. Que por cierto, nos va a ayudar mucho.


    1. Holy Spanish batman!!!! Maybe translate it to english as most of the readers of the blog are english speaking?? Unless I was mistaken as to the popularity of Shoemoney in Spanish social circles 🙂

  7. […] Continued here:  Google Ajax Libraries API & How To Save On Your WordPress Bandwidth […]

    1. That would be just one possible use of this. They would be stupid not to collect data. The more they know the better they can target their ads.

  8. I’m worried about the Google “data collection” as well. But if you do decide to use these, make sure you put in code to put the proper HTTP prefix in; if you try to load a JS include from http, but your user is currently in HTTPS, you’ll get errors in some browsers.

  9. To those who are paranoid about privacy, keep in mind that Google sets an expires header of +1 year on these libraries. So, if it’s already in your cache, the browser won’t make a request to Google at all, not even to check for a 304.

    If Google were truly doing this for purposes of tracking, they’d not set that expires header.

    I wrote a post about this recently which you may find useful. It’s specifically about jQuery, but everything mentioned applies equally to any of the libraries that Google hosts: http://encosia.com/2008/12/10/3-reasons-why-you-should-let-google-host-jquery-for-you/

  10. Actually worried about the Google “data collection” as well. But if you do decide to use these, make sure you put in code to put the proper HTTP prefix in; if you try to load a JS include from http, but your user is currently in HTTPS, you’ll get errors in some browsers.

  11. Interesting information, but I agree with the idea of not putting all your eggs in one basket.

    Google will continue to grow and continue to provide anything and everything it can in the process.

    If users start using everything from Google, what happens if Google ever goes away?

    There is something to be said for a savings of 6GB of bandwidth, but not if it lends itself to putting everything you have into Google’s hands.

  12. Google is the Nazi Germany/Roman Empire of the internet. As history always plays out the bigger they are the harder they fall. The evil Google empire will fall in time.

  13. Can anyone tell me if google ajax libraries is set up like a CDN (content delivery network)? e.g. if I live in Canada, do I get the javascript from a canadian server, if from Europe, from a European server?

    If so, that would be an additional benefit to using this, as it would result in faster javascript downloads. Plus, once it’s downloaded, the javascript should remain in cache, even on other sites who reference the same file.

    You can also accomplish this using google app engine, but for much more, like images, etc.. though I think doing this is a bit borderline.. google could easily delete the account if all you are doing is using their bandwidth.

    See http://24ways.org/2008/using-google-app-engine-as-your-own-cdn for info on how to do this.

  14. The problem with these hosted libraries is that Google will update them, not you. The plugins on your blog may work well with a library, but when the library is updated, the plugin may fail to work. Its better to host everything on your server so you can thoroughly test upgrades to determine if they are safe.

    1. Google keeps separate files for each version update from jquery, etc.. So you can just include jquery 1.2.6 and it won’t be updated, ever.

  15. […] Google Ajax Libraries API & How To Save On Your WordPress … […]

  16. I stand for variety of companies, brands, services,opportunities and etc. A person must have a choice and choose according to its tastes, desires and finances.

  17. You can also save bandwidth by using mod_expires to make users cache files that aren’t going to change longer.

    ExpiresActive on
    ExpiresDefault “access plus 1 month”

  18. […] first heard about the new Google AJAX Libraries API from Jeremy Schoemaker’s blog.  He mentions using it to reduce WordPress bandwidth, but really it can be used to reduce […]

  19. Very good to hear that they support ajax API for shared. M really planning to buy a package for me and dorp the dedicated

  20. Really Google host something that Yahoo owns… is it just me or is that weird?

  21. I think you are thinking like sukrat, but I think you should cover the other side of the topic in the post too…

  22. Thanks , I’ve just been searching for info about this subject for ages and yours is the best I’ve discovered till now. But, what about the conclusion? Are you sure about the source?

  23. Interesting! I liked your information:) It would be nice if you could to write a little more often, greetings from Poland 🙂

  24. Good day! I just would like to give a huge thumbs up for the good info you have got right here on this post. I will be coming again to your blog for more soon.

  25. I was just seeking this info for a while. After 6 hours of continuous Googleing, finally I got it in your website. I wonder what’s the lack of Google strategy that don’t rank this type of informative websites in top of the list. Generally the top sites are full of garbage.

  26. Superb website…

    […]always a big fan of linking to bloggers that I love but don’t get a lot of link love from[…]……

Comments are closed.