Using Google to Serve Up MooTools or JQuery

You’ll find a lot of tutorials online and various speed-testing tools that tell you to use a content distribution network (CDN) to serve up your images, style sheets and javascript files. When they say that, they’re referring to using cloud storage (a series of servers located across the world). CDN allows you to serve up your content locally to your visitors, making it quicker and easier for them to load your site.

Today, I discovered that Google actually provides a bunch of common javascript libraries, including MooTools, JQuery, Yahoo User Interface (YUI) and more, for free (though, they’ve apparently been doing so for at least a year). Instead of saving the javascript library to your own server and linking to it in that location, you simply link to the javascript files on Google’s server and it’s served up to all of your visitors from their CDN.

The next question is, though, whether or not it’s a good idea or if it’s even worth it to use Google’s CDN for this purpose. If all of the rest of your content is being served up from your local server, what’s the point in serving a single javascript file from Google? On top of that, Google only hosts certain parts of the libraries. For instance, you can serve up the MooTools core, but to use any of the MooTools “more” extensions, you have to compile them and store them on your own server. Unfortunately, the overwhelming majority of functions you’d perform with MooTools are heavily reliant on the extensions, so serving the core from Google’s CDN and the “more” from your own server is pointless. Of course, that’s just my opinion.

2 Responses

  • srisoftwarez

    Hi,
    I really like this post. When we use some of the google api’s we can not able to use it in our own server. Because it will have to fetch information from google like google maps, geoip location etc.

  • […] hosts most of the major JavaScript libraries on its own content distribution/delivery network (CDN) for everyone to use. However, WordPress actually comes bundled with many of the same JavaScript libraries. So, what are […]