Facebook 分享按钮不起作用

Facebook Share Button Doesn't Work

我从 facebook 开发者那里得到这段代码:https://developers.facebook.com/docs/plugins/share-button

<html>
<head>
    <title>Your Website Title</title>
    <!-- You can use Open Graph tags to customize link previews.
    Learn more: https://developers.facebook.com/docs/sharing/webmasters -->
    <meta property="og:url"           content="http://www.your-domain.com/your-page.html" />
    <meta property="og:type"          content="website" />
    <meta property="og:title"         content="Your Website Title" />
    <meta property="og:description"   content="Your description" />
    <meta property="og:image"         content="http://www.your-domain.com/path/image.jpg" />
</head>
<body>

    <!-- Load Facebook SDK for JavaScript -->
    <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";
      fjs.parentNode.insertBefore(js, fjs);
    }(document, 'script', 'facebook-jssdk'));</script>

    <!-- Your share button code -->
    <div class="fb-share-button" 
        data-href="http://www.your-domain.com/your-page.html" 
        data-layout="button_count">
    </div>

</body>
</html>

没有任何反应,没有出现按钮...怎么了?

Live Code on Code Pen

似乎没有添加实际的按钮元素。这是所有的代码吗?就像是 ''按钮类型="button">在 Facebook 上分享

好的,看起来一切都在那里,您只需要添加一个实际的按钮。您有一个代码和 link,但没有元素本身。 how to add a button via W3C

您遗漏了这部分:"Step 3: Place this code wherever you want the plugin to appear on your page":

<div class="fb-share-button" data-href="https://developers.facebook.com/docs/plugins/" data-layout="button_count" data-mobile-iframe="false"></div>

data-href 值需要是您自己的 link。

问题是 ADBLOCK,它隐藏了 div...