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!
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! 😉
WordPress already uses a lot of Google Features some even much more immature. (like google gears)
I think gears is the only feature that wordpress is actually using.
And this is totally different then gears.
Agree!
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/
I figured there was a plugin for this. Thanks for the link.
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)
@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.
someone have tested it?
That would save a lot of bandwidth for small shared hosting.
Thanks for sharing.. will do the changes. 🙂
Thanks Google, for making our lives better in so many ways 🙂
Very interesting (article & video)
Very useful tip, I’d imagine that Google’s servers are probably more robust than the ones my host are!
Definitely a useful writeup!!! A bit complicated for my blood tho hehehe
yea me too…
Yeah me too! I felt the need to tell everyone that.
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.
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.
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.
Agreed about faster. Using flikr for graphics, google for ads, my pages load much quicker, plus the bandwidth savings.
I thought that Flickr charges a fee if you want a certain amount of pictures uploaded?
[…] 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 […]
Muy bueno el articulo, me gusto y esta muy clarito las librerias de AJAX. Que por cierto, nos va a ayudar mucho.
Suerte
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 🙂
[…] Continued here:Â Google Ajax Libraries API & How To Save On Your WordPress Bandwidth […]
those are deffinitely overlooked internet secrets
Is Google’s agenda to collect data with this?
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.
Didn’t think about that until you mentioned it. Interesting point…
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.
More then 6 gb is way too much. Something is fishy.
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/
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.
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.
Peter, why is your comment almost exactly like mine?
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.
Absolutely right, they control everything on the net.
Nazi Germany? What would we call this? Google committing Webicide?
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.
Thanks off post.
Happy 2009.
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.
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.
[…] Google Ajax Libraries API & How To Save On Your WordPress … […]
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.
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”
Excellent! I didn’t knew you can do that…Thanks for the info!
Excellent! Thanks for the info, I didn’t know you can do that!
[…] 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 […]
Very good to hear that they support ajax API for shared. M really planning to buy a package for me and dorp the dedicated
Thats why I love this blog.
Really Google host something that Yahoo owns… is it just me or is that weird?
I think you are thinking like sukrat, but I think you should cover the other side of the topic in the post too…
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?
Interesting! I liked your information:) It would be nice if you could to write a little more often, greetings from Poland 🙂
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.
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.
Superb website…
[…]always a big fan of linking to bloggers that I love but don’t get a lot of link love from[…]……