Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AshikNesin/20ddb4d3dcb644807912a411053f80c2 to your computer and use it in GitHub Desktop.
Save AshikNesin/20ddb4d3dcb644807912a411053f80c2 to your computer and use it in GitHub Desktop.
Loading multiple 3rd party widgets asynchronously
(function() {
var script,
scripts = document.getElementsByTagName('script')[0];
function load(url) {
script = document.createElement('script');
script.async = true;
script.src = url;
scripts.parentNode.insertBefore(script, scripts);
}
load('//apis.google.com/js/plusone.js');
load('//platform.twitter.com/widgets.js');
load('//s.widgetsite.com/widget.js');
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment