Created
February 27, 2012 23:37
-
-
Save localpcguy/1927926 to your computer and use it in GitHub Desktop.
Async Third party script loader explicit render only (won't render on load of script)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
(function(w, d, s) { | |
function go() { | |
var js, fjs = d.getElementsByTagName(s)[0], load = | |
function(url, id, inTextOption) { | |
if (d.getElementById(id)) { return; } | |
js = d.createElement(s); js.src = url; js.id = id; | |
if (typeof inTextOption !== "undefined" && inTextOption.length) { | |
try { js.text = inTextOption; } // in try because .text="string" fails in Opera | |
catch (e) { js.innerText = inTextOption; } // for Opera | |
} | |
fjs.parentNode.insertBefore(js, fjs); | |
}; | |
load('//connect.facebook.net/en_US/all.js#xfbml=0', 'facebook-jssdk'); | |
load('//apis.google.com/js/plusone.js', 'gplus1js', '{"parsetags": "explicit"}'); | |
} | |
if (w.addEventListener) { w.addEventListener("load", go, false); } | |
else if (w.attachEvent) { w.attachEvent("onload", go); } | |
} (window, document, 'script')); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment