[英]Facebook:Blank Screen on FB Login
suddenly I am getting a strange thing happening in my application when trying to login via facebook. 突然,当我尝试通过Facebook登录时,我的应用程序中发生了一件奇怪的事情。 The facebook connect popup dialog will show a blank screen after asking for login details.
在询问登录详细信息后,facebook connect弹出对话框将显示空白屏幕。 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
我
Javascript SDK on Localhost
使用Javascript SDK on Localhost
Here is the code I'm using (copying directly from the facebook documentation): 这是我正在使用的代码(直接从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.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: 其他一些说明:
The URL it appears to hang on is here 它似乎挂起的URL就在这里
Thanks guys. 多谢你们。
Seems like a bug: https://developers.facebook.com/bugs/241915819261223?browse=search_4ff2ead131a032989098325 看起来像一个bug: https : //developers.facebook.com/bugs/241915819261223?broowse = 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 从上面链接中的注释,您可以尝试在端口80上运行您的应用程序并避免URL中的端口部分
Try the following code 请尝试以下代码
<html>
<body>
<div id="fb-root"></div>
<script type="text/javascript" src="http://connect.facebook.net/en_US/all.js"></script>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js" ></script>
<script>
FB.init({appId: fbAppId, status: true, cookie: true, xfbml: true});
$(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.');
}
});
});
});
</script>
<a href="javascript://" id="fb_button_login">Login</a>
</body>
</html>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.