我正在尝试在我的网页中包含Facebook登录/注册插件。每当我点击登录或点击注销时,都应该触发相应的FB.Event.subscribe。但在我的情况下,登录和注销成功。但这些事件都没有被触发。 找到下面的代码,FB.Event.subscribe - 没有事件被触发
<div id="fb-root"></div>
window.fbAsyncInit = function(){
FB.init({
appId : 'xxxxxxxxxxxxxxxxxxxx',
status : true,
cookie : true,
oauth : true,
xfbml : true
});
FB.Event.subscribe('auth.login', function(response) {
FB.api('/me', function(response) {
alert('You have successfully logged in, '+response.name+"!");
});
});
FB.Event.subscribe('auth.logout', function(response) {
FB.api('/me', function(response) {
alert('You have successfully logged out, '+response.name+"!");
});
});
FB.getLoginStatus(function(response) {
if (response.session) {
alert('Hello');
}
});
};
(function() {
var e = document.createElement('script');
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);
}());
这将是巨大的,如果有人可以帮助我在这里。提前致谢。