为什么没有出现类似fb的按钮?

dch*_*cke 7 facebook-like

我很沮丧,因为我花了好几个小时 - 这里还有其他线索,但是没有一个解决了我的问题!

我只想在我的网站www.posti.sh上实现类似fb的按钮 - 我想知道为什么它不起作用?

这是我使用的代码,根据https://developers.facebook.com/docs/reference/plugins/like/一步一步的教程:

<div id="fb-root"></div> (directly after the opening body tag)
Run Code Online (Sandbox Code Playgroud)

<div class="fb-like" data-href="http://www.posti.sh" data-send="true" data-width="450" data-show-faces="true"></div>
Run Code Online (Sandbox Code Playgroud)

我希望它在哪里.

我还在头部添加了相应的meta标签.

任何人都知道为什么它不起作用?

谢谢!!

丹尼斯

更新1

我使用了fb调试工具https://developers.facebook.com/tools/debug,它只说og图像不够大 - 我想这不应该是个问题吗?

fre*_*osh 4

看起来 HTML5 Like Button 代码中的步骤 1 缺少实际添加Javascript SDK 的部分。代码应该是:

<div id="fb-root"></div>
<script>
  window.fbAsyncInit = function() {
    FB.init({
      appId      : 'YOUR_APP_ID', // App ID
      channelUrl : '//WWW.YOUR_DOMAIN.COM/channel.html', // Channel File
      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', ref = d.getElementsByTagName('script')[0];
     if (d.getElementById(id)) {return;}
     js = d.createElement('script'); js.id = id; js.async = true;
     js.src = "//connect.facebook.net/en_US/all.js";
     ref.parentNode.insertBefore(js, ref);
   }(document));
</script>
Run Code Online (Sandbox Code Playgroud)