Posted By

jeremytarpley on 05/25/11


Versions (?)

Smart way to add jquery or other js from Google's cdn - fail over to local copy

 / Published in: JavaScript

if the Google cdn copy of jquery or what ever fails, use a local copy of the script

  1. <!-- Grab Google CDN's jQuery. fall back to local if necessary -->
  2. <script type="text/javascript" src=""></script>
  3. <script type="text/javascript">!window.jQuery && document.write('<script src="http://www.thiswebsitesdomain/js/jquery.js"><\/script>')</script>

Report this snippet  


RSS Icon Subscribe to comments
Posted By: mecha on May 27, 2011

you should credit the original author.

Posted By: jeremytarpley on July 12, 2011

Can't remember where I first found this or who originally created this technique but I've found a few others who are using it that reference Paul Irish's excellent html5 boilerplate.

You need to login to post a comment.