Facebook退出混乱 [英] Facebook Logout Confusion

查看:106
本文介绍了Facebook退出混乱的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个奇怪的问题,我有一个注销链接,只有当用户登录时才会显示。我有这个代码在这个链接的onclick事件中(使用一个函数):

  FB.logout(); 
window.location ='http://www.google.com';

如果我点击这一次,没有任何反应,我知道该函数被执行,因为我已经用警报进行测试。但是,如果我再次点击它,页面重新加载,用户确实已经注销。该页面永远不会指向google.com,因此该函数永远不会与window.location部分一样。



我有window.location,因为我认为如果我可以刷新页面使用window.location.refresh一旦注销完成,它会成功登录用户出来。不过,如果任何人有任何其他技巧,如何从用户界面退出,我很乐意听到他们的声音!我试图手动删除cookie,但是没有起作用,cookie由于某种原因仍然存在。我也尝试过:

  FB.logout(function(response){
window.location ='http ://www.google.com';
});

由于文档的原因,我知道这样的回调是可能的:

  http://developers.facebook.com/docs/reference/javascript/FB.logout 

有没有人有这个问题?任何建议将有助于谢谢!



更新:经过一些调试,我发现如果我点击链接一次。然后手动刷新它记录用户的页面。

解决方案

从您的描述中,我注意到注销正常工作,但是页面刷新不会。



尝试这样的事情:

  FB.logout(function(response){
window.location.reload(true);
});


I have a strange problem, I have a logout link that displays only if the user is logged in. I have this code inside the the onclick event of this link (using a function):

    FB.logout();
    window.location = 'http://www.google.com';

If I click on this once, nothing happens, I know that the function gets executed because I've tested this with an alert. However, if I click on it a second time, the page reloads itself and the user is indeed logged out. The page is never directed to google.com, so the function never gets as far as the window.location part.

I have the window.location because I thought that if I could refresh the page using window.location.refresh once the logout is complete that it would successfully log the user out. However, if anybody has any other techniques on how to logout the user out of facebook, I would love to hear them! I've attempted to manually delete the cookie, but that didn't work, the cookie still existed for some reason. I've also tried this:

    FB.logout(function(response) {
    window.location = 'http://www.google.com';
    });

I know a callback like this is possible because of the documentation:

http://developers.facebook.com/docs/reference/javascript/FB.logout

Has anybody else had this issue before? Any advice would help thanks!

UPDATE: After some debugging I've found out that if I click the link once. Then manually refresh the page it logs the user out.

解决方案

From your description it looks to me that logout is working properly, but page refresh doesn't.

Try something like this maybe:

FB.logout(function(response) {
    window.location.reload(true);
});

这篇关于Facebook退出混乱的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆