FB.Event.subscribe + comments.add不起作用吗? [英] FB.Event.subscribe + comments.add don't work?
本文介绍了FB.Event.subscribe + comments.add不起作用吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试在发送评论时捕获事件.我究竟做错了什么?我只想将每个用户评论也更新到Facebook群组墙,这就是为什么我需要赶上活动.
I'm trying to catch event when comment is sent. What am I doing wrong? I just want to update every user comment also to facebook group wall and that's why I need to catch the event.
<fb:comments numposts="10" ></fb:comments>
FB.init和事件捕获器:
FB.init and event catcher:
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : 'sensored-app-id',
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
/* All the events registered */
FB.Event.subscribe('comments.add', function (response) {
// do something with response
alert("comment added");
});
};
(function() {
var e = document.createElement('script');
e.src = document.location.protocol + '//connect.facebook.net/fi_FI/all.js';
e.async = true;
document.getElementById('fb-root').appendChild(e);
}());
</script>
推荐答案
您需要将notify="true"
属性添加到fb:comments
标记中.添加属性后,comments.add事件就会开始起作用.
You need to add notify="true"
attribute to the fb:comments
tag. Once you add the attribute the comments.add event begin to work.
<fb:comments numposts="10" notify="true"></fb:comments>
,或者,如果您使用的是较新的html5兼容标签:
or, if you're using the newer html5 compliant tags:
<div class="fb-comments" data-num-posts="10" data-notify="true" ></div>
这篇关于FB.Event.subscribe + comments.add不起作用吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文