【问题标题】:Facebook like button and add a comment eventFacebook喜欢按钮并添加评论事件
【发布时间】:2023-03-24 01:04:01
【问题描述】:

我在页面上有喜欢的按钮,我正在捕捉事件 edge.create 和 edge.remove。 我正在使用来自 Facebook 开发者页面的代码:

<div id="fb-root"></div>
<script>
(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "http://connect.facebook.net/en_US/all.js#xfbml=1";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));


window.fbAsyncInit = function() {
  FB.Event.subscribe("edge.create", function(targetUrl) {
    console.log("liked");
  });

  FB.Event.subscribe("edge.remove", function(targetUrl) {
    console.log("removed");
  });
}
</script>

<div class="fb-like" data-href="https://developers.facebook.com/docs/plugins/" data-layout="standard" data-action="like" data-show-faces="true" data-share="false"></div>

但是当用户点击弹出窗口中的“关闭”“添加评论”按钮时,我找不到捕获事件的方法。 我尝试使用“comment.create”和“message.send”,但没有成功。

有没有办法捕捉这些事件?

【问题讨论】:

  • 我也有同样的问题。你找到解决办法了吗?
  • 不行,恐怕暂时做不到。

标签: javascript facebook facebook-like


【解决方案1】:

请参阅 Marc Witteveen 的回答和我在 Catching the close or post to Facebook event of the Facebook comment box 的回答,以轮询评论对话框的高度。这对我有用。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-12-19
    • 1970-01-01
    • 1970-01-01
    • 2012-01-22
    • 2017-06-07
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多