Skip to content

Instantly share code, notes, and snippets.

@joshamburn
Last active August 29, 2015 14:13
Show Gist options
  • Select an option

  • Save joshamburn/19f7acec67bb544547ed to your computer and use it in GitHub Desktop.

Select an option

Save joshamburn/19f7acec67bb544547ed to your computer and use it in GitHub Desktop.
JQuery CDN Fallback to Local

#readme

  • drop the two script blocks into your html
  • first script block is for linking up with your choice of cdn
  • second script block checks for the jQuery object and lays in the local script block if it doesn't exist.
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="/static/js/jquery-1.7.2.min.js"><\/script>')</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment