I have this fb-login button on my website and it works pretty okay. How can I implement an logout button? Below is my code for the login part.
<fb:login-button size="small" onlogin="RedirectLogon();" perms="email,user_birthday" autologoutlink="true">
<%=LanguageManager.Instance.Translate("root/facebook/login")%>
</fb:login-button>
If you want to implement such buttons into one multifunctional button, use this:
<fb:login-button autologoutlink="true"></fb:login-button>
Note that if you add any custom code to the above line, the button won't work.
You can do it by using the following HTML and javascript function.
<script>
function fbLogout() {
FB.logout(function (response) {
//Do what ever you want here when logged out like reloading the page
window.location.reload();
});
}
</script>
<span id="fbLogout" onclick="fbLogout()"><a class="fb_button fb_button_medium"><span class="fb_button_text">Logout</span></a></span>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With