Last active
December 16, 2015 20:59
-
-
Save L1fescape/5496744 to your computer and use it in GitHub Desktop.
Fallback from cdn to local jquery
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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