Cannot make comments from facebook like button

2019-03-28 16:19发布

I get the like button code from https://developers.facebook.com/docs/reference/plugins/like/, and on my page, the like button is rendered correctly...at least it looks like so :P

But when I click on the like button, the comment dialog appear and disappear immediately, and the button becomes a Confirm link; then I click on the like, a popup window ask me to confirm to like it...then, when I back to my page, I can see the comment dialog. But whatever I input, after I clicked on the Post button, the dialog will not close.

In my Chrome console, I see when I click on the Post button, a request is make to https://www.facebook.com/plugins/like/comment, and the return result is:

for (;;);{"__ar":1,"payload":null}

I compared this behavior on other sites, and it is clear the return is different. But I have no idea why.

2条回答
甜甜的少女心
2楼-- · 2019-03-28 17:01

actually what luschn is right. you should create appID. facebook needs to count the LIKES when one clicks on it. you know, it's so simple. perhaps there's something you need to grab from the button :p

Try this stuff:

<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 = "//connect.facebook.net/de_DE/all.js#xfbml=1&appId=null";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

<span class="fb-like" data-href="https://www.facebook.com/fb-name"  data-layout="button" data-action="like"></span>

appID set into null. This works, but it's spamming. This is just for experiments only.

Here's the sample page: http://developer.appacyber.net/feed/test.php It also works on localhost :D

查看更多
ゆ 、 Hurt°
3楼-- · 2019-03-28 17:22

Usually that problem can be fixed by using an app id in the init code:

<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 = "//connect.facebook.net/de_DE/all.js#xfbml=1&appId=xxxxxxxxx";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

That´s Facebooks spam protection...

查看更多
登录 后发表回答