Facebook:FB登录上的空白屏幕 [英] Facebook:Blank Screen on FB Login
问题描述
我正在使用本地主机上的Javascript SDK
这是我正在使用的代码(直接从facebook文档复制):
window.fbAsyncInit = function(){
FB.init({appId:fbAppId,
status:false,
cookie:true,
xfbml:true
});
};
(function(d){
var js,id ='facebook-jssdk',ref = d.getElementsByTagName('script')[0];
if(d .getElementById(id)){return;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src =// connect。
ref.parentNode.insertBefore(js,ref);
}(document));
$(document).ready(function(){
$(#fb_button_login)。 (){
FB.login(function(response){
if(response.authResponse){
console.log('Welcome!获取您的信息) ...');
FB.api('/ me',function(response){
console.log('Good to see you,'+ response.name +'。');
});
} else {
console.log('用户取消登录或未完全授权');
}
});
});
});
其他一些说明:
- 这似乎是在所有浏览器上发生的。
- 我已经研究了所有其他帖子,似乎找不到适合我的解决方案
- 在控制台中没有显示错误信息
- 在开发我使用我专门为localhost设置的单独的FB应用程序ID时,使用指定的端口(已经工作了12个月以上
- 我没有启用沙盒模式
似乎挂起的网址是 here
似乎是一个错误:
https://developers.facebook.com/bugs/241915819261223?browse=search_4ff2ead131a032989098325
从上述链接的评论中,您可以尝试在端口80上运行应用程序,并避免在url中的端口部分
suddenly I am getting a strange thing happening in my application when trying to login via facebook. The facebook connect popup dialog will show a blank screen after asking for login details. Normally I would expect to see the window close, and then the site itself would carry on, however it appears to have hung.
I am using Javascript SDK on Localhost
Here is the code I'm using (copying directly from the facebook documentation):
window.fbAsyncInit = function () {
FB.init({ appId: fbAppId,
status: false,
cookie: true,
xfbml: true
});
};
(function (d) {
var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
if (d.getElementById(id)) { return; }
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
ref.parentNode.insertBefore(js, ref);
} (document));
$(document).ready(function () {
$("#fb_button_login").click(function () {
FB.login(function (response) {
if (response.authResponse) {
console.log('Welcome! Fetching your information.... ');
FB.api('/me', function (response) {
console.log('Good to see you, ' + response.name + '.');
});
} else {
console.log('User cancelled login or did not fully authorize.');
}
});
});
});
Some other notes:
- This appears to be happening on all browsers.
- I have researched all other posts and can't seem to find a solution that works for me
- There are no error messages showing up in console
- When developing I use a separate FB app ID that I have setup specifically for localhost with the designated port I'm using (has worked fine for more than 12 months)
- I do not have sandbox mode enabled
The URL it appears to hang on is here
Thanks guys.
Seems like a bug: https://developers.facebook.com/bugs/241915819261223?browse=search_4ff2ead131a032989098325
From the comments in the above link, you can try running your app on port 80 and avoid the port part in the url
这篇关于Facebook:FB登录上的空白屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!