我为我的网站创建了一个 facebook 登录应用程序。但是弹出窗口阻止程序会阻止它。我在谷歌搜索它说要添加一个 onclick 选项,我有一个。但它仍然无法正常工作。我在下面发布了我的代码
js代码:
$(document).ready(function() {
window.fbAsyncInitialize = function() {
FB.init({
appId : '', // App ID
channelUrl : '..../channel.html', // Channel File
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
FB.getLoginStatus(function(response) {
if (response.status === 'connected') {
// connected
apiCall();
} else if (response.status === 'not_authorized') {
// not_authorized
login();
} else {
// not_logged_in
login();
}
});
};
function login() {
FB.login(function(response) {
if (response.authResponse) {
// connected
apiCall();
} else {
// cancelled
}
}, { scope: 'email' });
}
function apiCall() {
console.log('Welcome! Fetching your information.... ');
FB.api('/me', function(response) {
var first_name = response.first_name;
var last_name = response.last_name;
var fb_id = response.id;
var email = response.email;
});
}
// 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/en_US/all.js";
ref.parentNode.insertBefore(js, ref);
}(document));
});
html:
我应该更改或添加什么来防止弹出窗口阻止程序问题?
谢谢