For personal projects or (even not so personal projects) using Google’s CDN hosted jQuery libraries is a no brainer. But what happens when you need a plan B? Or what happens when you realize that you need to have a fallback plan just in case Google is banned in a country where you have website visitors?

Well, the answer is a pretty neat trick I just learned. Taking advantage of the fact that Javascript is loaded synchronously – you can have a set of script tags that look like this:

<script type="text/javascript" src="//"></script>
<script type="text/javascript"> window.jQuery || document.write("<script src='/scripts/jquery-1.6.1.min.js'>\x3C/script>") </script>

Don’t forget YSlow guidance that says you should put your script tags near the bottom of your page!