Facebook FB.logout在IE中不起作用 [英] Facebook FB.logout not working in IE
问题描述
代码
function logoutFBUser()
{
//从网站和Facebook注销用户并重新加载$ b $ b alert(称为FB logout);
if(FB.getAuthResponse())
{
alert(has auth response);
FB.logout(function(response)
{
window.location.href ='/ accounts / logout?next = /';
});
alert(退出FB并重定向);
}
else
{
alert(no auth response);
window.location.href ='/ accounts / logout?next = /';
}
}
在Firefox中,我收到有auth响应
,但是在IE中,我收到警报 no auth response
。如果我只使用 FB.logout
而不使用 FB.getAuthResponse
则该函数在命中 FB.logout
。
我缺少什么?
最后解决了这个问题。我调试了javascript for FB.logout,由于某些原因它没有access_token这就是为什么调用FB.logout失败。研究Facebook文档导致我在我的网站上成功使用了我用于注销过程的URL
从Facebook文档退出登录
https:// www。 facebook.com/logout.php?next=REDIRECT_URI&access_token=LOGGEDINUSER_ACCESS_TOKEN
不用说,我在服务器端使用这个,所以不需要再使用javascript
有关详细信息,请参阅Facebook身份验证文档。
http://developers.facebook.com/docs/authentication/
感谢所有帮助
I am working on a django website which also allows users to sign in using their Facebook account. The login works fine, however I am not able to logout using Internet Explorer. The code seems to work fine on Firefox and Chrome.
Heres the code
function logoutFBUser()
{
//logout user from website and Facebook and reload
alert ("called FB logout");
if (FB.getAuthResponse())
{
alert ("has auth response");
FB.logout(function(response)
{
window.location.href = '/accounts/logout?next=/';
});
alert ("logged out of FB and redirected");
}
else
{
alert(" no auth response");
window.location.href = '/accounts/logout?next=/';
}
}
In Firefox, I get the alert of has auth response
, however in IE, I get the alert no auth response
. If I only use FB.logout
without FB.getAuthResponse
then the function hangs when it hits FB.logout
.
What am I missing?
Finally solved this. I debugged into the javascript for FB.logout and for some reason it doesnt have the access_token which is why the call to FB.logout fails. Researching the Facebook documentation led me to this URL which I used for the logout process on my website successfully
Logoutlink from Facebook Documentation
https://www.facebook.com/logout.php?next=REDIRECT_URI&access_token=LOGGEDINUSER_ACCESS_TOKEN
Needless to say, I am using this on the serverside, so no need to use javascript any more. Please refer Facebook Authentication documentation for more information.
http://developers.facebook.com/docs/authentication/
Thanks for all the help
这篇关于Facebook FB.logout在IE中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!