Google Ajax Libraries

Word Count: 359

I first learned about the Google Ajax Libraries about a month ago when I was reading through one of Hal Helms jQuery blog posts.

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:
  • jQuery
  • jQuery UI
  • Prototype
  • script.aculo.us
  • MooTools
  • Dojo
  • SWFObject
  • Yahoo! User Interface Library (YUI)

What does this mean to you? Let's say your working on a project and you need the latest copy of jQuery or the jQuery UI. You could go out and download the latest versions of each and install them on your server or you could use use the Google Ajax Libraries. The other advantage is they are minified and gziped so the size is pretty small along with the fact that it may already be cached in you end users browser. Here is an easy way to include both in your application.

I would love to hear others thoughts on this but here go mine. I don't like the idea of relying on this for production. Something about the thought of not having this on my server for production just gives me an uneasy feeling. I think for creating tutorials / demo's or even using this in development is a great idea and I am loving it. What do you guys think?

Comments

#1 Posted By: Brian Swartzfager Posted On: 4/15/09 10:52 AM
I feel the same way you do about relying on this for production: even though the odds of an outage at any given point are small, it's another point of failure, and one that could be hard to diagnose.
#2 Posted By: Dan Vega Posted On: 4/15/09 10:54 AM |
Author Comment
I think its great for tutorials though because then someone can download the code and run it without worrying about dependencies.
#3 Posted By: Jules Gravinese Posted On: 4/15/09 11:20 AM
Here's a nice tip/benefit:
The Google Ajax Libraries API can be used to automatically load the latest version of the library. Using Prototype for example, the last part of the url can be changed to /1.6/prototype.js for the latest 1.6.* release, or /1/prototype.js for the latest 1.* release.
#4 Posted By: Todd Rafferty Posted On: 4/15/09 11:39 AM
@Jules: I heard the google.load() is slower than just calling directly.

@Dan & Brian: This is a CDN. What are the odds that google.com would go down? Rather yet, it's not on the google.com domain, it's on googleapis.com. The point of a CDN is that there is no single point of failure and it should find you another access point. Yes, I know it's still possible for something to go completely wrong, but I think the odds are smaller than we think.

For public sites, I don't mind it. For Extranets/internal stuff, I'm certainly not going to use it for privacy reasons. I'm sure google follows every lead to a new domain they can get it and searches the hell out of it.
#5 Posted By: Daniel Kim Posted On: 4/15/09 1:19 PM
i'm sure there is a cleaner way to code this, but a possible solution is to a check for the jQuery object, and if not, reference the site's copy.

It still requires the site having it's own version of the file, but allows utilizing the benefits of Google's servers.

<invalidTag src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/...; type="text/javascript"></script>
<invalidTag type="text/javascript">
if (typeof jQuery == "undefined") {
document.write('<invalidTag type="text/javascript" src="_assets/js/lib/jquery-1.3.2.min.js"><\/script>');
}
</script>
#6 Posted By: Brian Swartzfager Posted On: 4/15/09 1:42 PM
@Todd: I'm sure the odds of Google's CDN going down completely are extremely low, but IF it fails I'm not going to know that that's the problem until I troubleshoot it (and I am the only person in line to fix any such problem). On the other hand, if it's hosted locally and the site goes down, at least it's all down. :)

And your point about Google using the service to add to their knowledge about domains gives me an even better reason not to use it (thanks!): all but one of my projects are extranet/internal web applications not meant for the wider world.
#7 Posted By: Claude Posted On: 4/16/09 12:38 AM
I use Google and Yahoo's CDNs for our public sites.

The biggest advantage of everyone using the CDNs is that popular libraries would be cached on the user's browser by the time they visit your site, eliminating the need to load a new copy, which results in perceived and actual performance inprovement.

Read Steve Souders' rules for high performance web sites.
#8 Posted By: Alexa25TK Posted On: 1/19/10 5:39 PM
I know that you have to know about this topic and <a href=" http://www.exclusivepapers.com">essay writing</a>. At the custom writing services that’s so easy to order research papers or <a href=" http://www.exclusivepapers.com">custom essays</a> about this good post.


Post Your Comment

Leave this field empty







Show Captcha

If you subscribe, any new posts to this thread will be sent to your email address.

Copyright © 2007 Dan Vega | BlogCFC was created by Raymond Camden. This blog is running version 5.8.001.