Google Chrome浏览器上没有关闭FB.login对话框 [英] FB.login dialog does not close on Google Chrome
问题描述
我在应用程序中的点击事件上调用 FB.login()
。对话框按预期弹出,但是当用户完成登录到Facebook(和/或授权应用程序)时,对话框不会关闭。相反,它会加载一个白页(对话框内),标题更改为 XD代理。
I'm calling FB.login()
on a click event in my application. The dialog pops up as expected, but when the user is done logging into Facebook (and/or authorizing the app), the dialog does not close. Instead it loads a white page (inside the dialog) and the title changes to XD Proxy.
这只会发生在Google Chrome上(我' m使用Windows 7现有的最新版本)。
This only happens on Google Chrome (I'm using the latest version available right now for Windows 7).
如果Chrome处于隐身模式,则不会发生。
This doesn't happen if Chrome is in Incognito mode.
fb-login'社交插件'在Chrome上可以正常工作。
The fb-login 'social plugin' works fine on Chrome.
为了进一步测试/调试,我创建了一个带有香草设置的新的Facebook应用程序。我所做的唯一更改是在应用设置中设置了网站网址。这是您可以用来重现这个错误的HTML代码。
To test/debug this further, I created a new Facebook App with vanilla settings. The only change I made was set the Site URL in the app settings. Here's HTML code that you can use to recreate this bug.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Chrome Bug Test</title>
</head>
<body>
<button onclick="dologin()">Login using Facebook</button>
<div id="fb-root"></div>
<script src="http://connect.facebook.net/en_US/all.js"></script>
<script>
FB.init({
appId : '[YOUR APP ID HERE]',
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
</script>
<script type="text/javascript">
function dologin(){
FB.login(function(r){
if(console && console.log) {
console.log(r);
}
});
}
</script>
</body>
</html>
我尝试更改的Facebook设置
Facebook Settings that I've tried changing
- 设置网站域,没有改变任何内容。
- 使用自定义的channelUrl和频道文件也没有帮助。 b $ b
- Setting a site domain, didn't change anything.
- Using a custom channelUrl and channel file, didn't help either.
在Facebook追踪的相关错误
- http://bugs.developers.facebook.net/show_bug.cgi?id=14789
- https://github.com/facebook / connect-js / issues / 269
- http://bugs.developers.facebook.net/show_bug.cgi?id=12112
- http://developers.facebook.com/bugs/278247488872084
- http://bugs.developers.facebook.net/show_bug.cgi?id=14789
- https://github.com/facebook/connect-js/issues/269
- http://bugs.developers.facebook.net/show_bug.cgi?id=12112
- http://developers.facebook.com/bugs/278247488872084
- 带FB连接的空白弹出窗口
- Facebook连接空白弹出chrome
- Facebook Connect登录重定向到Chrome和Safari
- https://stackoverflow.com/questions/4423718/blank-page-with-fb-connect -js-sdk-on-after-permission-request
- Facebook连接在互联网浏览器8上登录时显示空白弹出窗口
- Facebook登录弹出窗口在IE中使用Fb.login时保持打开状态
- JS SDK FB.login()工作,但弹出对话框在登录后保持打开
- Facebook登录挂起XD代理何时通过Chrome网上应用店安装页面
- XD代理Facebook
- XD_Proxy弹出式窗口赢关闭
- Blank popup with FB connect
- facebook connect blank pop up on chrome
- Facebook Connect Login redirecting in Chrome and Safari
- https://stackoverflow.com/questions/4423718/blank-page-with-fb-connect-js-sdk-on-after-permission-request
- Facebook connect showing blank popup on login in Internet explorer 8
- Facebook login popup window stays open when using Fb.login in IE
- JS SDK FB.login() works but pop-up dialog is staying open after logged in
- Facebook login hangs at "XD Proxy" when page is installed via Chrome Web Store
- XD Proxy Facebook
- XD_Proxy popup won't close
Related bugs tracked at Facebook
我已经看到很多人遇到这个,但是我没有错,我没有能够为此找到具体的解决方案。 Facebook还没有回应错误报告。一个解决方案是摆脱基于Javascript的身份验证码,并使用服务器机制(Facebook PHP SDK)。我想避免由于时间限制。
I've seen many people come across this, but what bugs me is that I haven't been able to find a concrete fix for this. Facebook hasn't responded to bug reports yet. One solution would be get rid of Javascript based authentication code and do it solely using serverside mechanism (Facebook PHP SDK). I'd like to avoid that due to time constraints.
任何人都有任何想法如何解决这个问题?
Anyone have any ideas how to fix this?
推荐答案
在 FB.init
之后调用此代码片段解决了我的问题。但是其他解决方案似乎适用于不同的情况。
Calling this snippet after FB.init
fixed the issue for me. But other solutions seem to have worked for different cases.
$.browser.chrome = /chrome/.test(navigator.userAgent.toLowerCase());
if ($.browser.chrome || $.browser.msie) {
FB.XD._origin = window.location.protocol + "//" + document.domain + "/" + FB.guid();
FB.XD.Flash.init();
FB.XD._transport = "flash";
} else if ($.browser.opera) {
FB.XD._transport = "fragment";
FB.XD.Fragment._channelUrl = window.location.protocol + "//" + window.location.host + "/";
}
这篇关于Google Chrome浏览器上没有关闭FB.login对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!