Created
July 18, 2012 05:04
-
-
Save azizmb/3134325 to your computer and use it in GitHub Desktop.
FB init
This file contains 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
<div id="fb-root"></div> | |
<script> | |
var fbAppId = '< APP ID >'; | |
(function(){ | |
var fbInitFuncs = []; | |
var fbInitialized = false; | |
window.fbAsyncInit = function() { | |
fbInitialized = true; | |
FB.init({ | |
appId : '< APP ID >', | |
status : true, | |
cookie : true, | |
xfbml : true | |
}); | |
for(var i=0; i < fbInitFuncs.length; i++){ | |
fbInitFuncs[i](); | |
} | |
}; | |
window.onFbInit = function(func){ | |
if(fbInitialized){ | |
func(); | |
} | |
else{ | |
fbInitFuncs.push(func); | |
} | |
} | |
})(); | |
(function() { | |
var e = document.createElement('script'); | |
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js'; | |
e.async = true; | |
document.getElementById('fb-root').appendChild(e); | |
}()); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment