Skip to content

Instantly share code, notes, and snippets.

View grimicorn's full-sized avatar

Danny Holloran grimicorn

View GitHub Profile
@grimicorn
grimicorn / snippet.js
Created March 24, 2012 16:18 — forked from necolas/snippet.js
Optimised async loading of cross-domain scripts
/*
* Updated to use the function-based method described in http://www.phpied.com/social-button-bffs/
* Better handling of scripts without supplied ids.
*
* N.B. Be sure to include Google Analytics's _gaq and Facebook's fbAsyncInit prior to this function.
*/
(function(doc, script) {
var js,
fjs = doc.getElementsByTagName(script)[0],