Skip to content

Instantly share code, notes, and snippets.

@lafikl lafikl/asyncScripts.js
Last active Dec 16, 2015

Embed
What would you like to do?
Load Scripts asynchronously.
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
You can’t perform that action at this time.