3

我有代码:

window.fbAsyncInit = function(){
FB.init({appId: myapid, status: true, cookie: true, xfbml: true});
FB.Event.subscribe('comment.create', function(response) {
  alert('Thanks for Your comment!');
});
FB.Event.subscribe('comment.remove', function(response) {
  alert('You deleted comment!');
 });
};

为什么每次用户(我测试过)添加或删除评论时它都不会触发?

我测试过:

window.fbAsyncInit = function(){
 alert('123');
}

它工作完美。

那么 FB.event 处理程序中的问题是什么?如何让它每次都正常工作?

打开 my_site.com 或 www.my_site.com 有区别吗?或不?我的 my_site.com 只有一个 Appid。

如何处理页面上的每个 FB.event,以便我可以看到所有这些并选择“comment.create”?

谢谢你!

4

1 回答 1

0

我确定这段代码有问题

FB.Event.subscribe

这样您就无法将评论事件订阅到 FB。为什么不仔细检查以确保代码有效,例如:

if (FB && FB.Event && FB.Event.subscribe) { 
/* subscribe code */ 
}

或者

console.log(FB);
于 2012-12-05T04:17:55.750 回答