Google hosting popular javascript libraries

I came across this yesterday looking for the mootools download link. Google is hosting a bunch of the popular javascript libraries on their server for you.

Pros:

  • Use Google's Bandwidth
  • Google takes care of keeping the files up to date
  • Common include code across your apps
  • Use Google as a Fast proxy
  • Gadgets will have access to cached files

Cons:

  • Have to rely on Google to keep files up to date
  • Probably won't include beta releases of libraries

The main page is here and currently includes:

Example jQuery:

<script src="http://www.google.com/jsapi"></script>
<script>
  // Load jQuery
  google.load("jquery", "1");

  // on page load complete, fire off a jQuery json-p query
  // against Google web search
  google.setOnLoadCallback(function() {
    $.getJSON("http://ajax.googleapis.com/ajax/services/search/web?q=google&;v=1.0&;callback=?",

      // on search completion, process the results
      function (data) {
        if (data.responseDate.results &&
            data.responseDate.results.length>0) {
          renderResults(data.responseDate.results);
        }
      });
    });
</script>