Skip to content

Instantly share code, notes, and snippets.

@jakearchibald
Created June 2, 2011 09:40
Show Gist options
  • Save jakearchibald/1004177 to your computer and use it in GitHub Desktop.
Save jakearchibald/1004177 to your computer and use it in GitHub Desktop.
Twitter widgets
(function(document){
var script = 'script',
twitterWidgets = document.createElement(script),
lastScript = document.getElementsByTagName(script)[0];
twitterWidgets.async = twitterWidgets.src = 'http://platform.twitter.com/widgets.js';
lastScript.parentNode.insertBefore(twitterWidgets, lastScript);
})(document);
// compressed 177 bytes
(function(a){var b="script",c=a.createElement(b),d=a.getElementsByTagName(b)[0];c.async=c.src="http://platform.twitter.com/widgets.js",d.parentNode.insertBefore(c,d)})(document)
// insertAfter might work too, saving another byte, but haven't tested
@mathiasbynens
Copy link

@miketaylr, do you happen to have more details on when the current version(s) of Opera actually respect .async=true?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment