Created
July 2, 2013 11:01
-
-
Save pid/5908434 to your computer and use it in GitHub Desktop.
Load JavaScript from CDN, fallback: load from local webserver
This file contains 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 type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> | |
<script type="text/javascript"> | |
if (typeof jQuery === "undefined") { | |
var script = document.createElement('script'); | |
var attr = document.createAttribute('type'); | |
attr.nodeValue = 'text/javascript'; | |
script.setAttributeNode(attr); | |
attr = document.createAttribute('src'); | |
attr.nodeValue = '/scripts/jquery-1.3.2.min.js'; | |
script.setAttributeNode(attr); | |
document.getElementsByTagName('head')[0].appendChild(script); | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment