While in a previous post I talked about WordPress database optimization, with this post I intend to show you how to improve your sites performance a bit more by hosting your javascripts with Google.
This only works if you’re using jQuery, prototype or another library that is supported by Google’s AJAX Librararies API.
While those javascript libraries are included with WordPress and WordPress can already serve them in a reasonably efficient way, there’s an even better solution: use the Google Libraries plugin.
This plugin makes use of said API, serving the files out from Google’s content distribution network. No matter how fast your hosting is, even with my super WordPress hosting and MaxCDN WordPress CDN setup I’m willing to bet that Google’s CDN is faster.
Don’t believe me? Here are 3 more reasons.



Wow,. that’s an awesome tip – gonna try this on a couple blogs ASAP
thanks Joost!
And Google will update their API pretty quickly, for good or bad…
Another great plugin. Congrats :)
I installed the plugin, how do I verify that jQuery is run from Google content network?
By checking your pages source :)
I checked the source page after I installed, but I didn’t clear the cache.
But, I can see it load from Google Content Library after I cleared the browser’s cache.
From Page Source
Thanks.
I love the security leaks this can cause. Everybody trusts Google
Yeah, we do :)
Well, yes, everybody trusts Google’s CDN because it serves up (last I checked) something like 17% of all the internet’s web traffic. That’s a fair amount of traffic and I sort of expect them to get it right because of that.
We’ve used the plugin for a while now. Works fine. It would be even better if it moved the Google script request to the bottom of the page so not to speed up page load times even further.
Just installed it and saw google’s api url. My pages are quite fast anyway but never hurts to optimise further. Thanks again Joost!
Thanks so much for the kind words about my plugin. I’m always glad to hear when people find them useful.
thank u so muchhh
even i agree with you even i have seen the difference ..
thanks Joost… gotta try it now,
Will try it soon.
Interesting, but first I’ll have to try and see if it’s compatible with WP-Minify, which compacts my JS (and CSS).
Not everyone trusts Google that much, because this method does give Google info on every visitor to your site (referrer, IP, etc) to the extent they pull the library. I addressed this at http://www.johnon.com/647/google-ajax-api.html and got some responses from Ben Lisbakken of Google.
As for speed and reliability, the comments in the article you link to actually demonstrate it is NOT yet a good idea to rely on Google’s CDN (see recent comments at http://encosia.com/2008/12/10/3-reasons-why-you-should-let-google-host-jquery-for-you/)
Already using this technique for my blogger blog! It is awesome and really fast CDN!
thank u so much for ur great tips and help