Last active
December 16, 2015 18:49
-
-
Save lafikl/5480809 to your computer and use it in GitHub Desktop.
Load Scripts asynchronously.
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 LoadScriptsAsync (src) { | |
if(!src) throw new Error('LoadScriptsAsync : You have to add a script src!'); | |
var script = document.createElement('script'), | |
head = document.getElementsByTagName('head')[0]; | |
script.type = "text/javascript"; | |
script.src = src; | |
script.async = true; // new property in HTML5 : http://davidwalsh.name/html5-async | |
head.appendChild(script); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment