Facebook的登录警告
问题描述:
我得到通知如下:测试时的Facebook登录:Facebook的登录警告
你是在一个小的浏览器窗口或弹出使用“页”的显示类型。为了获得更好的用户体验,请使用我们的JavaScript SDK显示此对话框,而不指定明确的显示类型。 SDK将为每个环境选择最佳的显示类型。或者,如果您有特殊要求,不能使用SDK,请使用显示类型'popup'。此消息仅对您的应用程序的开发人员可见。
这里是JavaScript,我相信负责:
window.fbAsyncInit = function() {
FB.init({
appId : '<?php echo $this->getAppId() ?>', // App ID
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
};
// Load the SDK Asynchronously
(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/<?php echo $this->getLocale() ?>/all.js";
ref.parentNode.insertBefore(js, ref);
}(document));
function greet(id){
FB.api('/me', function(response) {
var src = 'https://graph.facebook.com/'+id+'/picture';
$$('.welcome-msg')[0].insert('<img height="20" src="'+src+'"/>');
});
}
function fblogin(){
try {
FB.login(function(response) {
if (response.status == 'connected') {
var url = '<?php echo $this->getLoginUrl() ?>';
setLocation(url);
} else if (response.status === 'not_authorized') {
alert('<?php echo $this->__('Please, approve our application') ?>');
} else {
// user is not logged in
window.location.reload();
}
}, {scope:'email'});
} catch (err) {
fblogin();
}
return false;
}
谢谢
答
请确保弹出宽度不应超出580(长),高400像素。如果你确定这些事情,警告就会消失。
如何设置宽度和高度? – Freejoy
window.open('example.html','page','width = 580,height = 400'); – Sandeep