Like thousands of other sites, the Guardian uses the excellent jQuery framework to power our javascript. Previously, our jQuery build was stored internally in our R2 platform, along with the other script files we use (Twitter feed refreshers, page analytics, image carousels and article comment counts, to name just a few). In release 102 of our R2 software, we’ve replaced this with Google’s hosted version of the library – you can read about other changes in the release over at Martin’s blog entry.
This has a number of (admittedly small) risks, but also a range of benefits: the file has a stronger chance of being cached on the user’s end as other sites reference Google’s copy, and since Google use a worldwide CDN, our overseas users can actually download the file from a closer server than guardian.co.uk can offer them. Obviously there’s the chance that Google might go down or become otherwise unreachable, but we’re fairly confident that this happens so infrequently that the benefits outweigh the risks.
Just in case everything does fall apart over at Mountain View, though, we’ve put in a failsafe – browsers will fall back to our own internal copy of jQuery if Google’s version doesn’t load. We’re pretty confident though – Twitter uses the same file on their main homepage, and software development site Stack Overflow uses it exclusively. Hopefully by using it on guardian.co.uk we’ll help increase the number of web users with a cached copy of jQuery on their systems.