Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Load jQuery without using conditional comments.
if('querySelector' in document
&& 'localStorage' in window
&& 'addEventListener' in window) {
// Add jQuery 2.0+
document.write('<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"><\/script>')
} else {
// Add jQuery 1.9.0+
document.write('<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"><\/script>')
}
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.