无法嵌入Facebook帖子

时间:2014-08-06 15:48:35

标签: javascript html facebook facebook-javascript-sdk facebook-sdk-3.0

我想让我的fb帖子直接显示在我的网站上。它可以工作,如果我使用链接,但我希望它直接嵌入我的网站。我完全按照他们告诉我的内容......任何想法?

    <script>
  window.fbAsyncInit = function() {
    FB.init({
      appId      : '739994246046761',
      xfbml      : true,
      version    : 'v2.0'
    });
  };

  (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/en_US/sdk.js";
     fjs.parentNode.insertBefore(js, fjs);
   }(document, 'script', 'facebook-jssdk'));
</script>

<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/en_US/sdk.js#xfbml=1&appId=739994246046761&version=v2.0";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>


<div class="fb-like-box" data-href="https://www.facebook.com/binghamtoncrushes" data-width="600" data-height="250" data-colorscheme="light" data-show-faces="false" data-header="false" data-stream="true" data-show-border="true"></div>

1 个答案:

答案 0 :(得分:0)

<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/en_US/all.js#xfbml=1";
   fjs.parentNode.insertBefore(js, fjs); 
 }
 (document, 'script', 'facebook-jssdk'));
</script>
<div class="fb-post" data-href="https://www.facebook.com/video.php?v=10152504396908837" data-width="466">
<div class="fb-xfbml-parse-ignore">
<a href="https://www.facebook.com/video.php?v=10152504396908837">Post</a> by <a href="https://www.facebook.com/HuffPostSports">HuffPost Sports</a>.</div>
</div>