Facebook像使用edge.create的回调事件无法正常工作 [英] Facebook like callback event using edge.create is not working

查看:52
本文介绍了Facebook像使用edge.create的回调事件无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,在用户喜欢Facebook页面之后,我已经检查了互联网以执行代码.

So i've checked the internet to execute a code after a user liked a facebook page.

<html>
<head>
  <title>Your Website Title</title>
</head>
<body>

<div id="fb-root"></div>
<script>

    window.fbAsyncInit = function() {
        FB.init({
          appId            : '1517163758543318',
          autoLogAppEvents : true,
          xfbml            : true,
          version          : 'v3.1'
        });


        FB.Event.subscribe('edge.create', function(href, widget) {
            alert('You just liked the page!');
            console.log('You just liked the page!11111111111111');
        });
    };



    (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 = 'https://connect.facebook.net/en_GB/sdk.js#xfbml=1&version=v3.1&appId=380576395482732&autoLogAppEvents=1';
      fjs.parentNode.insertBefore(js, fjs);
    }(document, 'script', 'facebook-jssdk'));

</script>

<div 
    class="fb-like" 
    data-href="https://www.facebook.com/When-you-dont-know-what-to-do-281837755939599/" 
    data-layout="standard" 
    data-action="like" 
    data-size="small" 
    data-show-faces="true" 
    data-share="false">
</div>
</body>
</html>

有时它会发出警报,有时却没有发出警报,我想知道我做错了什么.有人可以指出我正确的方向吗?或给我一些建议.

Sometimes it alerts and sometimes it doesn't and i wonder what im doing wrong. Can someone point me to the right direction? Or give me some suggestion on doing this.

我已经检查过一些链接 Facebook赞";按钮回调 Facebook赞";按钮回调帮助 Facebook FB.Event .subscribe"bug"使用edge.create回调无法获取'edge.create'回调以与facebook javascript SDK配合使用 Facebook";喜欢"按钮回调帮助

some links i've checked Facebook "Like" button callback, Facebook "Like" button callback help , Facebook FB.Event.subscribe "bug" with the edge.create callback , Can't get 'edge.create' callback to work with facebook javascript SDK , Facebook like callback function not working in opera , Facebook "Like" button callback help ,

推荐答案

如果选中

If you check https://developers.facebook.com/docs/reference/javascript/FB.Event.subscribe/v3.1, you’ll notice that the edge.create event type is not listed there any more.

Facebook已删除此内容-他们不希望网站通过向用户显示赞"按钮,然后再等待此事件来强迫"赞.

Facebook has removed this - they do not want sites to be able to "force" a like, by presenting the user with a like button and then waiting for this event, any more.

您现在只能通过JS SDK订阅的事件与身份验证状态更改以及呈现到页面中的社交插件的呈现有关.

The only events you can subscribe to now via the JS SDK are related to the auth status changing, and when social plugins embedded into a page have been rendered.

https://developers.facebook.com/blog/post/2017/11/07/changes-developer-offerings/?locale=zh_CN :

edge.create和edge.remove JS SDK事件:这些事件将不再可访问.或者,您可以使用我们的Webhooks,并在有人喜欢您的Facebook页面之一时收到通知.

edge.create and edge.remove JS SDK Events: These Events will no longer be accessible. As an alternative, you can use our Webhooks and be notified every time someone likes one of your Facebook Pages.

这篇关于Facebook像使用edge.create的回调事件无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆