Skip to main content

Another slightly less than perfect solution (HTML5 only) would be to load the library on DOMContentLoaded.

document.addEventListener('DOMContentLoaded', function() {  (function(d,s,id){   var js,fjs = d.getElementsByTagName(s)[0];   if(d.getElementById(id)){return;}   js=d.createElement(s);   js.id=id;   js.src="//connect.facebook.net/en_US/all.js#xfbml=1";   fjs.parentNode.insertBefore(js,fjs); } (document, "script", "facebook-jssdk") );  

});

Another slightly less than perfect solution (HTML5 only) would be to load the library on DOMContentLoaded.

document.addEventListener('DOMContentLoaded', function() { (function(d,s,id){ var js,fjs = d.getElementsByTagName(s)[0]; if(d.getElementById(id)){return;} js=d.createElement(s); js.id=id; js.src="//connect.facebook.net/en_US/all.js#xfbml=1"; fjs.parentNode.insertBefore(js,fjs); } (document, "script", "facebook-jssdk") ); 

});

Another slightly less than perfect solution (HTML5 only) would be to load the library on DOMContentLoaded.

document.addEventListener('DOMContentLoaded', function() {  (function(d,s,id){   var js,fjs = d.getElementsByTagName(s)[0];   if(d.getElementById(id)){return;}   js=d.createElement(s);   js.id=id;   js.src="//connect.facebook.net/en_US/all.js#xfbml=1";   fjs.parentNode.insertBefore(js,fjs); } (document, "script", "facebook-jssdk") );  
Source Link
user5236399
user5236399

Another slightly less than perfect solution (HTML5 only) would be to load the library on DOMContentLoaded.

document.addEventListener('DOMContentLoaded', function() { (function(d,s,id){ var js,fjs = d.getElementsByTagName(s)[0]; if(d.getElementById(id)){return;} js=d.createElement(s); js.id=id; js.src="//connect.facebook.net/en_US/all.js#xfbml=1"; fjs.parentNode.insertBefore(js,fjs); } (document, "script", "facebook-jssdk") ); 

});