Thomas Fuchs
Hi, I'm Thomas Fuchs. I'm the author of Zepto.js, of script.aculo.us, and I'm a Ruby on Rails core alumnus. With Amy Hoy I'm building cheerful software, like Freckle Time Tracking and Every Time Zone and write books like Retinafy.me.
   Want me to speak at your conference? Contact me!

Google-served JavaScript libraries

May 27th, 2008

Thanks to Dion Almaer and Google, you can now use served-off-googles-infrastructure versions of your favourite JavaScript libraries, including Prototype and script.aculo.us.

The files are served with proper caching headers and fully compressed (GZIP), so you don’t have to do it yourself.

In Dion’s words:

  • Developers won’t have to worry about getting caching setup correctly, as we will do that for you
  • If another application uses the same library (much more likely), they there is a much better chance that it will be already caching on the users machine
  • The network and bandwidth of the users systems will not be taxed.

You can either use Google’s API loader (see link to docs below), or just use direct URLs. For example the following code block will load in Protoype and script.aculo.us’ effects (ignore the linebreaks!):

<script src="http://ajax.googleapis.com/ajax/libs/prototype/1.6.0.2/prototype.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/scriptaculous/1.8.1/effects.js"></script>

You can read up on this at the documentation site.