开发者

logout button in FaceBook SDK

I have this fb-login button on my website and it works pretty okay. How can I implement an l开发者_如何学运维ogout 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>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜