Skip to content

Instantly share code, notes, and snippets.

@wildeyes
Created May 14, 2016 20:43
Show Gist options
  • Save wildeyes/9711c53bf0869e781477e8a81c8b286b to your computer and use it in GitHub Desktop.
Save wildeyes/9711c53bf0869e781477e8a81c8b286b to your computer and use it in GitHub Desktop.
Async Script Loading in Browser Javascript Snippet
(function(url) {
var scriptTag = document.createElement('script');
scriptTag.type = 'text/javascript';
scriptTag.async = true;
scriptTag.src = url;
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(scriptTag, s);
})(URL);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment