简体   繁体   English

Facebook Like Box不起作用

[英]Facebook Like Box doesn't work

I've been having a problem with a facebook like-box for a client, and me and a friend simply can't figure out what we're doing wrong, and it's been close to three days of staring at it. 对于一个客户来说,我一直遇到一个类似于Facebook的问题,而我和一个朋友根本无法弄清楚我们做错了什么,并且已经接近三天了。 Here's the code we get from developers.facebook.com: 这是我们从developers.facebook.com获得的代码:

    <div id="fb-root"></div>
    <script>(function(d){
      var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
      js = d.createElement('script'); js.id = id; js.async = true;
      js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
      d.getElementsByTagName('head')[0].appendChild(js);
    }(document));</script>
    <div class="fb-like-box" data-href="http://www.facebook.com/pages/mywebsite/11111111111"      
data-width="280" data-colorscheme="dark" data-show-faces="true" data-stream="true" data-header="false"></div>

Nothing shows up. 什么都没有出现。 We did get this piece of code to work, but it doesn't quite work the way we want to: 我们确实让这段代码工作,但它并不像我们想要的那样工作:

<div id="fb-root"></div>
<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>
<fb:like-box href="http://www.facebook.com/pages/mywebsite/1111111111" width="280" colorscheme="dark" show_faces="true" border_color="" stream="true" header="false"></fb:like-box>

You have to log in to facebook to see the feed, but the client want it to always show up. 您必须登录Facebook才能看到Feed,但客户希望它始终显示。

You need to add http: in line 5 of the head script like this... 你需要在head脚本的第5行添加http:这样...

js.src = "http://connect.facebook.net/en_US/all.js#xfbml=1";

its a html5 thing. 这是一个html5的事情。

Perhaps you should try the latest code; 也许你应该尝试最新的代码; Facebook appear to have modified the Like box generator . Facebook似乎修改了Like框生成器

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM