Cannot make comments from facebook like button

扶醉桌前 提交于 2019-12-04 22:52:33

问题


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.


回答1:


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...




回答2:


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



来源:https://stackoverflow.com/questions/13803477/cannot-make-comments-from-facebook-like-button

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!