0
找不到類似的問題,所以我會問。facebook登錄API調用時間
我正在嘗試在我的頁面上使用Facebook登錄。
我根據開發人員指南做了所有事情。 但是,我不確定何時可以開始調用FB.API調用。用戶何時通過身份驗證?我怎麼知道這個操作何時完成?
<script>
window.fbAsyncInit = function() {
FB.init({
appId: 'someID', // App ID
channelUrl: '//www.domain.com/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
});
};
// Load the SDK Asynchronously
(function (d) {
var js, id = 'facebook-jssdk'; if (d.getElementById(id)) { return; }
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
d.getElementsByTagName('head')[0].appendChild(js);
} (document));
</script>
現在我希望讓此
FB.api('/me', function (response) {
facebookUser = response;
alert('Your name is ' + response.name);
});
但是,當是寫入時間不能確定。無論我把它放在什麼地方,我都會得到undefined:/
謝謝!只是我缺少的方法 – Guy 2012-01-28 18:07:19