0
我正在構建Facebook IFrame應用程序,我請求用戶允許該應用程序的權限。當用戶第一次登錄我的應用程序時,IFrame應用程序將彈出一個窗口來請求用戶允許權限。如何在top.location上創建Facebook FB.login()對話框
我的問題是:我不希望這個權限窗口彈出,這個彈出窗口可以像「top.location.href」,只是在我的應用程序頁面的頂部。
我的代碼是
window.fbAsyncInit = function() {
FB.init({appId: '',
status: true,
cookie: true,
xfbml: true,
oauth : true //enables OAuth 2.0
});
FB.getLoginStatus(function(response) {
if (response.authResponse) {
} else {
FB.login();
}
});
};
(function() {
var e = document.createElement('script');
e.type = 'text/javascript';
e.src = document.location.protocol +
'//connect.facebook.net/en_US/all.js';
e.async = true;
document.getElementById('fb-root').appendChild(e);
}());
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 + '.');
FB.logout(function(response) {
console.log('Logged out.');
});
});
} else {
console.log('User cancelled login or did not fully authorize.');
}
}, {scope: 'email'});