fb登录弹出窗口 [英] fb login popup block

查看:157
本文介绍了fb登录弹出窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用fb登录功能,但问题来到我是,每当我在页面媒体加载完成之前点击fb登录按钮,它会阻止fb登录的弹出窗口,但是如果在第二次传递到fblog后点击fblogin加载事件它的作品



这是我使用的功能:

  function fb_login(){
var email ='';
console.log(loginClassbackQueue);
// console.log('user want to login with fb');
FB.getLoginStatus(function(response){
if(response.status!='connected'){
FB.login(function(response){
// console。 log(response);
if(response.authResponse){
// console.log('user logged in successfully');
// console.log(response);
email = update_f_data_login(response);
$('#fb_login_popup,#popup_overlay')hide();
// loginme(email);
}
else {
loginClassbackQueue = [];
// console.log('user failed to login');
}
// console.log('fb login completed successfully');
},{scope:email,user_birthday,user_likes,user_location,friends_likes,publish_actions}
);
}
else {
// console.log登录并连接');
email = u pdate_f_data_login(响应);
$('#fb_login_popup,#popup_overlay')。hide();
}

});

}

在本网站上执行的相同操作 http://fab.com/ 它打开弹出窗口永远不会阻止弹出窗口。

解决方案

您不能从 FB.getLoginStatus 的回调函中调用 FB.login



浏览器倾向于阻止弹出窗口的弹出窗口不是用户点击操作的直接结果。



因为 FB.getLoginStatus 执行 ajax 调用,并调用 FB.login 对此响应,由于该呼叫而打开的弹出窗口是阻止



解决您的问题将在页面加载时调用 FB.getLoginStatus ,并使用 fb_login()方法中的响应。


I am making using fb login feature but problem comming to me is that whenever I click on the fb login button before page media loading is completed, it blocks the popup for fb login but if I click on fblogin after a second passed to loading event it works

Here is the function I am using:

function fb_login() {
var email='';
console.log(loginClassbackQueue);
// console.log('user wants to login with fb');
FB.getLoginStatus(function(response) {
    if(response.status!='connected'){
        FB.login(function(response) {
            // console.log(response);
            if (response.authResponse) {
                // console.log('user logged in successfully');
                // console.log(response);
                email = update_f_data_login(response);
                $('#fb_login_popup, #popup_overlay').hide();
                // loginme(email);
                } 
            else {
                    loginClassbackQueue = [];
                // console.log('user failed to login');
                }
                // console.log('fb login completed successfully');
            }, {scope:"email,user_birthday,user_likes,user_location,friends_likes,publish_actions"}
        );
        }
    else{
    // console.log('logged in and connected');
    email = update_f_data_login(response);
    $('#fb_login_popup, #popup_overlay').hide();
    }

});

}

The same action when I do on this site http://fab.com/ it open popups always never block a popup.

解决方案

You cannot call FB.login from the callback of FB.getLoginStatus.

Browsers tend to block popup windows of the popup is not spawned as an immediate result of a user's click action.

Because FB.getLoginStatus does an ajax call and you call FB.login on it's response, the popup that would open as a result of this call is blocked.

A solution to your problem would be to call FB.getLoginStatus on page load and use the response inside your fb_login() method.

这篇关于fb登录弹出窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆