我試圖查看用戶是否在我的網站上登錄到FB。我在下面的代碼,但不管我是否登錄到我的FB帳戶或FB.getLoginStatus響應總是返回null。FB.getLoginStatus總是返回null,無論用戶是否登錄到FB
<script type="text/javascript">
window.fbAsyncInit = function() {
FB.init({appId: 'XXXXXXXXXXXXXXX', status: true, cookie: true,
xfbml: true});
FB.getLoginStatus(function(response) {
if (response.session) {
alert('Logged In');
} else {
alert('Not Logged In');
}
});
};
(function() {
var e = document.createElement('script'); e.async = true;
e.src = document.location.protocol +
'//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);
}());
</script>
你只是登錄Facebook的網站,或與您的網站上的Facebook連接?你是否能夠對FB api進行其他調用(如彈出登錄表單)?之前工作過嗎? – serg 2010-09-19 22:30:13
剛登錄FB網站。是的,我可以彈出登錄表單並顯示我的帳戶圖片。沒有這是一個新的網站。 – Splashlin 2010-09-19 22:53:51