Hosting your JS at Google

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 WestHost WordPress hosting I'm willing to bet that Google's CDN is faster.

Don't believe me? Here are 3 more reasons.

20 Responses to “Hosting your JS at Google”

  1. Wow,. that's an awesome tip - gonna try this on a couple blogs ASAP

    thanks Joost!

  2. And Google will update their API pretty quickly, for good or bad...

  3. Another great plugin. Congrats :)

  4. I installed the plugin, how do I verify that jQuery is run from Google content network?

  5. 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.

  6. I love the security leaks this can cause. Everybody trusts Google

  7. 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.

  8. Just installed it and saw google's api url. My pages are quite fast anyway but never hurts to optimise further. Thanks again Joost!

  9. Thanks so much for the kind words about my plugin. I'm always glad to hear when people find them useful.

  10. even i agree with you even i have seen the difference ..

  11. thanks Joost... gotta try it now,

  12. Interesting, but first I'll have to try and see if it's compatible with WP-Minify, which compacts my JS (and CSS).

  13. 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/)

  14. Already using this technique for my blogger blog! It is awesome and really fast CDN!

  15. thank u so much for ur great tips and help

Comments closed, if you feel you have something to say:
drop me a line.

1 Trackbacks to “Hosting your JS at Google”

  1. links for 2009-06-16 - Ogo - Tue, June 16th, 2009 at 22:02