我从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>
什么也没发生,没有按钮出现...怎么了?
代码笔上的实时代码
似乎没有添加实际的按钮元素。这就是所有代码吗?类似的东西''按钮类型="按钮">在Facebook上分享
好的,一切似乎都在那里,你只需要添加一个实际的按钮。您有一个代码和链接,但没有元素本身。如何通过 W3C 添加按钮
您省略了这一部分:"第 3 步:将此代码放置在您希望插件出现在页面上的任何位置":
<div class="fb-share-button" data-href="https://developers.facebook.com/docs/plugins/" data-layout="button_count" data-mobile-iframe="false"></div>
data-href
值必须是您自己的链接。
问题是 ADBLOCK,它隐藏了div...