Skip to content

Instantly share code, notes, and snippets.

@L1fescape
Last active December 16, 2015 20:59
Show Gist options
  • Save L1fescape/5496744 to your computer and use it in GitHub Desktop.
Save L1fescape/5496744 to your computer and use it in GitHub Desktop.
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 src="js/jquery-2.0.0.min.js">\x3C/script>')</script>
<!-- or Require js -->
<script>
requirejs.config({
enforceDefine: true,
paths: {
jquery: [
'//ajax.aspnetcdn.com/ajax/jquery/jquery-2.0.0.min',
//If the CDN location fails, load from this location
'js/jquery-2.0.0.min'
]
}
});
//Later
require(['jquery'], function ($) {
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment