Created
January 10, 2012 01:14
-
-
Save joshje/1586145 to your computer and use it in GitHub Desktop.
Asyncronously load javascript by passing in a URL
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
function async(url) { | |
var a = document.createElement('script'); | |
a.async = true; | |
a.src = url; | |
var b = document.getElementsByTagName('script')[0]; | |
b.parentNode.insertBefore(a, b); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment