简体   繁体   English

Facebook页面插件在网页中不起作用

[英]facebook page plugin not working in webpage

Here is my code: 这是我的代码:

<div id="fb-root"></div>
<script>
  window.fbAsyncInit = function() {
    FB.init({
      appId      : '1680466125563156',
      xfbml      : true,
      version    : 'v2.5'
    });
  };



  (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 class="fb-page" data-href="https://www.facebook.com/Hireatent" data-tabs="timeline" data-width="300" data-small-header="false" data-adapt-container-width="true" data-hide-cover="false" data-show-facepile="true">

    <div class="fb-xfbml-parse-ignore"><blockquote cite="https://www.facebook.com/Hireatent">
       <a href="https://www.facebook.com/Hireatent">Hire-a-Tent</a>   </blockquote>
    </div>
 </div>

I have added the above-mentioned code in my webpage but when I open the index.html in my local machine I am not getting the desired output (fb page timeline is not showing up instead I just get a link to my FB page (see attached image) 我已经在网页中添加了上述代码,但是当我在本地计算机上打开index.html时,却没有得到想要的输出(fb页面时间轴没有显示,相反,我只是获得了指向FB页面的链接(请参见附件图片)

在此处输入图片说明

Is this because I am opening this in my local machine or am I missing something here? 这是因为我要在本地计算机上打开它还是在这里丢失了某些东西? TIA TIA

Change this: 更改此:

js.src = "//connect.facebook.net/en_US/sdk.js";

To This: 为此:

js.src = "https://connect.facebook.net/en_US/sdk.js";

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

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