I have been getting a lot of users looking for either the Facebook Connect logout button or the way it is implemented. The Facebook Connect logout function is very easy to set up. All all you need to do is make sure you have included the following code in your page.
Note: I wont touch on basic Facebook Connect setup here, I assume you are already able to login successfully. If not, check out my post on setting up FBConnect from scratch.
HTML:<a href = \"#\" onclick = \"FB.Connect.logout(function() { FBCLogout(); }); return(false);\">
<img id = \"fb_logout_image\" src = \"http://static.ak.fbcdn.net/images/fbconnect/logout-buttons/logout_small.gif\" alt = \"Connect\" />
</a>
JavaScript:<script type="text/javascript">
function FBCLogout() {
FB.XFBML.Host.parseDomTree();
}
</script>
It's just that simple. The logout button is loaded directly from Facebook so no need to worry about that, and the anchor tag calls the FCBLogout() function I made to parse the DOM tree to update the Facebook authentication status.
I also like setting Facebook Connect logout this way because it allows you to add AJAX right in the JavaScript function above the FB code when you are ready to add it.
I hope this helps.
Comments