您好我正在尝试将facebook插件添加到我的页面,但它没有出现。我尝试不同的页面,但它不适用于任何人。一个例子是上面的
我在打开<body>
标记后立即放置了这些代码:
<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/el_GR/sdk.js#xfbml=1&version=v2.5&appId=1712213445680154"; fjs.parentNode.insertBefore(js, fjs);}(document, 'script', 'facebook-jssdk'));</script>`
然后我将我的插件的代码放在我希望它出现在我的页面上但我什么都没看到?发生了什么事?
<div class="fb-page" data-href="https://www.facebook.com/sportdog" data- height="340" data-small-header="false" data-adapt-container-width="true" data-hide-cover="false" data-show-facepile="true" data-show-posts="true"><div class="fb-xfbml-parse-ignore"><blockquote cite="https://www.facebook.com/sportdog"><a href="https://www.facebook.com/sportdog">SportDog.gr</a></blockquote></div></div>
答案 0 :(得分:0)
我的答案很晚,但是它很有价值,我在研究了几个小时之后遇到了同样的问题,我按照以下方式开展工作。试一试,它适合你。您可以自定义iframe
的选项,即 width,show_facepile,small_header等
List of all customisable options can be found there.
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : '1614814185438138',
xfbml : true,
version : 'v2.5'
});
};
(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";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
<iframe name="f11d8956d8" height="1000px" frameborder="0" allowtransparency="true" allowfullscreen="true" scrolling="no"
title="fb:page Facebook Social Plugin" src="http://www.facebook.com/v2.5/plugins/page.php?adapt_container_width=true&app_id=1614814185438138&channel=http%3A%2F%2Fstaticxx.facebook.com%2Fconnect%2Fxd_arbiter.php%3Fversion%3D42%23cb%3Df43cf5f68%26domain%3Dwww.facebook.com%26origin%3Dhttp%253A%252F%252Fwww.facebook.com%252Ff245f287b8%26relation%3Dparent.parent&container_width=200&hide_cover=false&href=https%3A%2F%2Fwww.facebook.com%2FAndresIniesta&locale=en_GB&sdk=joey&show_facepile=true&small_header=true&tabs=timeline"
class="" style="border: none; visibility: visible;">
</iframe>
</body>
</html>