Facebook fbAsyncInit firing twice
- by JoelD
I'm using Facebook's Javascript SDK to allow login/logout, and my problem is that when I use their window.fbAsyncInit call to initiate the FB session, it always fires twice. I've included a simplified code sample. I'd appreciate any help!
<html><head>
<script type="text/javascript">
...some of my own functions, not related to Facebook...
</script>
</head>
<body>
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : '<?php echo FACEBOOK_APPID; ?>',
session : <?php echo json_encode($session); ?>, status:false, cookie:true, xfbml: true
});
alert("1");
FB.getLoginStatus(function(response) {
if(response.session) { ...do stuff... } else { ...do other stuff...}
});
};
alert("2");
</script>
...page contents...
</body></html>
The "2" alert fires a single time, and then the "1" alert fires twice.