對於我的生活,我無法獲得Event.subscribe('auth.authResponseChange')的工作。請參閱下面的代碼facebook FB.Event.subscribe('auth.authResponseChange')不起作用
<div id="fb-root">
</div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId: 'XXXXXXXXXXXXXXX', // App ID
channelUrl: 'http://XXXXXXXX.us/', // Channel File
status: true, // check login status
cookie: true, // enable cookies to allow the server to access the session
xfbml: true // parse XFBML
});
FB.Event.subscribe('auth.authResponseChange', function (response) {
alert('The status of the session is: ' + response.status);
});
};
// 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));
</script>
<div class="fb-login-button" data-size="xlarge" scope="email" data-show-faces="false"
data-width="400" data-max-rows="1" autologoutlink="true">
Login with Facebook</div>
登錄按鈕呈現。我也可以註銷。唯一的問題是,auth.response更改不會觸發,我沒有收到「消息」彈出框
FBML不久將被取消。最好不要使用它。 – InspiredJW 2012-07-27 10:03:49
@InspiredJW FBML已經被棄用,這是XFBML,不會被棄用的東西 – 2012-08-07 02:16:07
你有沒有試過根據文檔檢查'response [0]'?*請注意,在某些情況下,響應的值是不加鍵的,但當返回多個變量時,它包含相應的鍵。* => http://developers.facebook.com/docs/reference/javascript/FB.Event.subscribe/ – PlantTheIdea 2013-10-29 21:55:18