最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Facebook Like Box doesn't work - Stack Overflow

programmeradmin0浏览0评论

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. Here's the code we get from developers.facebook:

    <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/en_US/all.js#xfbml=1";
      d.getElementsByTagName('head')[0].appendChild(js);
    }(document));</script>
    <div class="fb-like-box" data-href=""      
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=".js#xfbml=1"></script>
<fb:like-box href="" 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.

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. Here's the code we get from developers.facebook.:

    <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/en_US/all.js#xfbml=1";
      d.getElementsByTagName('head')[0].appendChild(js);
    }(document));</script>
    <div class="fb-like-box" data-href="http://www.facebook./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/en_US/all.js#xfbml=1"></script>
<fb:like-box href="http://www.facebook./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.

Share Improve this question edited Jan 12, 2012 at 17:01 Colin Mackay 19.2k8 gold badges64 silver badges91 bronze badges asked Sep 13, 2011 at 23:21 mrkerlinmrkerlin 311 silver badge2 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 5

You need to add http: in line 5 of the head script like this...

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

its a html5 thing.

Perhaps you should try the latest code; Facebook appear to have modified the Like box generator.

发布评论

评论列表(0)

  1. 暂无评论