Enable Facebook comments on site without a Faceboo

2019-08-05 07:25发布

From what I can read om Facebook Dev Docs this is how I add the comment box on my web site:

//In HTML Header
<script>
  window.fbAsyncInit = function() {
    FB.init({
      appId      : 'xxxxxxxxxxxxxxxx', // App ID
      status     : true, // check login status
      cookie     : true, // enable cookies to allow the server to access the session
      xfbml      : true  // parse XFBML
    });

    // Additional initialization code here
  };

  // Load the SDK Asynchronously
  (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/sv_SE/all.js";
     d.getElementsByTagName('head')[0].appendChild(js);
   }(document));
</script>

//Where I want my comments to show
<div class="fb-comments" data-href="<?=curPageURL()?>" data-num-posts="5" data-width="944"></div>

And... If I want to add admins to the comments I can add this to my meta-data:

<meta property="fb:admins" content="jamie.telin"/>
<meta property="fb:app_id" content="xxxxxxxxxxxxxxxxxx"/>

But am I correct as to this being the only way, or atleast that I must have created an Facebook App to use Facebook Comments? If I am not misstaken, this wasn't required before.

3条回答
劫难
2楼-- · 2019-08-05 08:03

You can Add it without any app or app ID Too easy The easiest comment box to implement would be using Facebook comments. You could take a look at this link: https://developers.facebook.com/docs/reference/plugins/comments/

查看更多
Bombasti
3楼-- · 2019-08-05 08:13

No, FB social plugins doesn't need an App ID - they are rendered into an iframe originating from facebook.com, so FB login status and cookies as accessible to them.

Make sure that you set status: false and cookie: false in your FB.init() call. Do not provide any appId param.

查看更多
小情绪 Triste *
4楼-- · 2019-08-05 08:16

Yes, you need an App ID. In order to have an App ID, you have to create a Facebook App.

查看更多
登录 后发表回答