Skip to content

Instantly share code, notes, and snippets.

@cbourdage
Created May 30, 2014 17:02
Show Gist options
  • Select an option

  • Save cbourdage/8ab93d4f6dd7da96caef to your computer and use it in GitHub Desktop.

Select an option

Save cbourdage/8ab93d4f6dd7da96caef to your computer and use it in GitHub Desktop.
<script>
(function(doc, script) {
var js,
s = doc.getElementsByTagName(script)[0],
load = function(src, callback, id) {
if (d.getElementById(id)) return;
js = doc.createElement(script);
js.src = src;
js.id = id;
//js.async = true;
if (typeof callback === 'function') {
js.onload = function() {
callback();
}
}
s.parentNode.insertBefore(js, s);
};
load('url', function() {}, 'id-to-pass');
load('url', function() {}, 'id-to-pass');
load('url', function() {}, 'id-to-pass');
}(document, 'script'));
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment