Did you know Google hosts various JavaScript library for you? They currently support:
- jQuery
- jQuery UI
- Prototype
- script.aculo.us
- MooTools
- Dojo
- SWFObject
- Yahoo! User Interface Library (YUI)
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!











- Comment Likes
- Comment Dislikes






January 21, 2009 at 7:41 am
I think you are thinking like sukrat, but I think you should cover the other side of the topic in the post too…
January 9, 2009 at 10:41 am
Really Google host something that Yahoo owns… is it just me or is that weird?
January 3, 2009 at 2:14 pm
Thats why I love this blog.
January 3, 2009 at 12:49 am
Very good to hear that they support ajax API for shared. M really planning to buy a package for me and dorp the dedicated
December 30, 2008 at 2:24 am
Excellent! Thanks for the info, I didn’t know you can do that!
December 30, 2008 at 2:24 am
Excellent! I didn’t knew you can do that…Thanks for the info!
December 29, 2008 at 9:05 am
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”
December 29, 2008 at 12:23 am
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.
December 28, 2008 at 7:19 pm
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.
December 29, 2008 at 2:27 am
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.
December 28, 2008 at 6:27 pm
Thanks off post.
Happy 2009.
December 28, 2008 at 4:29 pm
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.
December 28, 2008 at 3:29 pm
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.
December 28, 2008 at 5:47 pm
Absolutely right, they control everything on the net.
December 30, 2008 at 1:20 am
Nazi Germany? What would we call this? Google committing Webicide?
December 28, 2008 at 2:39 pm
Peter, why is your comment almost exactly like mine?
December 28, 2008 at 1:22 pm
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.
December 28, 2008 at 12:09 pm
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.
December 28, 2008 at 11:23 am
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/
December 28, 2008 at 10:35 am
More then 6 gb is way too much. Something is fishy.
December 28, 2008 at 10:14 am
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.
December 28, 2008 at 9:57 am
Is Google’s agenda to collect data with this?
December 28, 2008 at 10:14 am
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.
December 30, 2008 at 1:18 am
Didn’t think about that until you mentioned it. Interesting point…
December 28, 2008 at 9:54 am
those are deffinitely overlooked internet secrets
December 28, 2008 at 9:41 am
Muy bueno el articulo, me gusto y esta muy clarito las librerias de AJAX. Que por cierto, nos va a ayudar mucho.
Suerte
December 28, 2008 at 1:19 pm
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
December 28, 2008 at 8:16 am
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.
December 28, 2008 at 9:42 am
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.
December 28, 2008 at 5:08 pm
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.
December 28, 2008 at 7:54 pm
Agreed about faster. Using flikr for graphics, google for ads, my pages load much quicker, plus the bandwidth savings.
January 3, 2009 at 8:21 am
I thought that Flickr charges a fee if you want a certain amount of pictures uploaded?
December 28, 2008 at 8:11 am
Definitely a useful writeup!!! A bit complicated for my blood tho hehehe
December 31, 2008 at 3:38 am
yea me too…
December 31, 2008 at 5:50 am
Yeah me too! I felt the need to tell everyone that.
December 28, 2008 at 7:58 am
Very useful tip, I’d imagine that Google’s servers are probably more robust than the ones my host are!
December 28, 2008 at 7:37 am
Very interesting (article & video)
December 28, 2008 at 6:54 am
Thanks Google, for making our lives better in so many ways
December 28, 2008 at 6:50 am
That would save a lot of bandwidth for small shared hosting.
Thanks for sharing.. will do the changes.
December 28, 2008 at 6:40 am
There’s a plugin that should handle this, but I haven’t tested it myself yet:
http://wordpress.org/extend/plugins/use-google-libraries/ (requires php5)
December 28, 2008 at 9:53 am
@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.
@Wesley
Thanks for the tip. That just extends the coolness of how useful this post is.
December 28, 2008 at 11:29 am
someone have tested it?
December 28, 2008 at 6:19 am
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!
December 28, 2008 at 10:55 am
Wordpress already uses a lot of Google Features some even much more immature. (like google gears)
December 28, 2008 at 11:08 am
I think gears is the only feature that wordpress is actually using.
And this is totally different then gears.
December 28, 2008 at 11:29 am
Agree!
December 28, 2008 at 1:30 pm
Thanks for sharing Jeremy….and also just for the rest there is a plug in that would handle the task for you heres the link. http://wordpress.org/extend/plugins/use-google-libraries/
December 30, 2008 at 12:40 am
I figured there was a plugin for this. Thanks for the link.