Skip to content

Instantly share code, notes, and snippets.

@Error-331
Created June 6, 2013 20:29
Show Gist options
  • Save Error-331/5724652 to your computer and use it in GitHub Desktop.
Save Error-331/5724652 to your computer and use it in GitHub Desktop.
How to include scripts at runtime
[
'//other-domain.com/1.js',
'2.js'
].forEach(function(src) {
var script = document.createElement('script');
script.src = src;
document.head.appendChild(script);
});
[
'//other-domain.com/1.js',
'2.js'
].forEach(function(src) {
var script = document.createElement('script');
script.src = src;
script.async = false;
document.head.appendChild(script);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment