为了添加Facebook页面插件,我使用以下代码
'<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 -->
<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>
</head>
<body>
<div class="fb-page" data-href="https://www.facebook.com/TheDivert/" data-tabs="timeline" 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/TheDivert/"><a href="https://www.facebook.com/TheDivert/">The Divert</a></blockquote></div></div>
</body>
</html>
但结果是只创建了一个超链接,并且未显示代码所在位置https://developers.facebook.com/docs/plugins/page-plugin上显示的结果。任何人都可以找到我的代码的问题,因为我认为面书代码是正确的。
答案 0 :(得分:1)
试试这个:
<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 -->
<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&version=v2.5";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
</head>
<body>
<div class="fb-page" data-href="https://www.facebook.com/TheDivert/" data-tabs="timeline" 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/TheDivert/"><a href="https://www.facebook.com/TheDivert/">The Divert</a></blockquote></div></div>
</body>
</html>
与以前相同的代码,除了你失踪:
<div id="fb-root"></div>
和XFBML版本号:
&version=v2.5
我通过将您的代码与https://developers.facebook.com/docs/plugins/page-plugin
生成的代码进行比较来解决这个问题我已经在实时服务器上对此进行了测试,但是如果没有,请告诉我。
旁注:在测试时,请记得关闭Ghostery和/或其他FB阻止浏览器扩展程序。