Skip to content

Instantly share code, notes, and snippets.

@subtleGradient
Created August 23, 2011 01:55
Show Gist options
  • Select an option

  • Save subtleGradient/1164132 to your computer and use it in GitHub Desktop.

Select an option

Save subtleGradient/1164132 to your computer and use it in GitHub Desktop.
Safe loadAsyncScript implementation
function loadAsyncScript(URL) {
var script = document.createElement('script'),
firstScript = document.getElementsByTagName('script')[0];
script.async = 1;
script.src = URL;
firstScript.parentNode.insertBefore(script, firstScript);
}
loadAsyncScript('ext.js');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment