8
我使用Facebook的JavaScript的SDK,並試圖確定用戶是否登錄或沒有,我有以下代碼:Facebook的JS SDK - FB.getLoginStatus =未定義
window.fbAsyncInit = function() {
FB.init({
appId:'139894666087975', cookie:true, status:true, xfbml:true
});
$('.login_fb').click(function(){
FB.login(function(response) {
if(response.session)
{
if (response.perms) {
window.location.reload();
}
}
},{perms:'email,user_birthday,user_hometown,user_location,publish_stream'});
});
FB.getLoginStatus(function(response) {
alert(response.authResponse);
if (response.authResponse) {
alert(response.authResponse);
} else {
$.blockUI({
message: $('#fblogin'),
css: {
top: '9%',
left: ($(window).width() - 700) /2 + 'px',
width: '700px',
cursor: 'hand',
border: '10px solid #ccc',
}
});
}
});
};
的response.AuthResponse爲getLoginStatus是'未定義',但我實際上是使用爲此應用程序設置的權限登錄的。
任何想法爲什麼它會繼續顯示爲undefined?當我嘗試再次登錄時,它僅關閉Facebook框(因爲我已經登錄)並刷新頁面,再次顯示「未定義」。
感謝您的幫助!
我永遠不會想到這是一個修復!哇,謝謝史蒂夫! – iUsable