Skip to content

Instantly share code, notes, and snippets.

@PatrickJS
Last active December 16, 2015 21:29
Show Gist options
  • Save PatrickJS/5500131 to your computer and use it in GitHub Desktop.
Save PatrickJS/5500131 to your computer and use it in GitHub Desktop.
Snippet: CDNs fail, but your scripts don't have to - fallback from CDN to local jQuery
<script src="//ajax.aspnetcdn.com/ajax/jquery/jquery-2.0.0.min.js"></script>
<script>window.jQuery || document.write('<script type="text/javascript" src="scripts/jquery-ui-1.8.24.js"><\/script'')</script>
script(src='//ajax.aspnetcdn.com/ajax/jquery/jquery-2.0.0.min.js')
script.
window.jQuery || document.write('<script type="text/javascript" src="scripts/jquery-ui-1.8.24.js"><\/script>')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment