Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Load jQuery 1.7.1 from the CDN. If it loads put it into noConflict mode. If it doesn't, load the local copy. Keep checking until the local copy loads and put that into noConflict mode.
<script type="text/javascript" src=""></script>
var $$;
// If 1.7.1 is loaded, put it into noConflict mode
if(window.jQuery().jquery = '1.7.1') {
$$ = $.noConflict(true);
} else {
// If it is not loaded, load the local version
document.write("<script src='/js/jquery-1.7.1.js'>\x3C/script>");
// Keep checking until it is loaded
var intervalID = window.setInterval(function() {
// If it is loaded, put it into noConflict mode and clear the interval
if(window.jQuery().jquery == '1.7.1') {
$$ = $.noConflict(true);
} else {
// keep trying
}, 1000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.