更新时间:2023-12-04 17:40:34
(" ).click(函数() { FB.logout(函数() {窗口.位置 .reload(); }); }); } < / 脚本 >
("#auth-logoutlink").click(function() { FB.logout(function() { window.location.reload(); }); }); } </script>
Facebook登录身份验证示例
Facebook Login Authentication Example
<div id="auth-status">
<div id="auth-loggedout">
<div class="fb-login-button" autologoutlink="true" scope="email,user_checkins">Login with Facebook</div>
</div>
<div id="auth-loggedin" style="display: none"> Hi, <span id="auth-displayname"></span>(logout) </div> </div> </body> </html>
预先感谢.
Thanks in advance.
使用此脚本注销Facebook.它可以在我的网站上运行
Use this script for facebook logout. It works on my site
<form>
<div id="fb-root">
<script language="javascript">
window.onload=function()
{
// initialize the library with your Facebook API key
FB.init({ apiKey: 'b65c1efa72f570xxxxxxxxxxxxxxxxx' });
//Fetch the status so that we can log out.
//You must have the login status before you can logout,
//and if you authenticated via oAuth (server side), this is necessary.
//If you logged in via the JavaScript SDK, you can simply call FB.logout()
//once the login status is fetched, call handleSessionResponse
FB.getLoginStatus(handleSessionResponse);
}
//handle a session response from any of the auth related calls
function handleSessionResponse(response) {
//if we dont have a session (which means the user has been logged out, redirect the user)
if (!response.session) {
window.location = "/mysite/Login.aspx";
return;
}
//if we do have a non-null response.session, call FB.logout(),
//the JS method will log the user out of Facebook and remove any authorization cookies
FB.logout(handleSessionResponse);
}
</script>
</div></form>