问题
Hello I am trying to add a facebook plugin to my page but it doesn't appear. I try it for different pages but it doesn't working for no one. One example is the above
I put these code just right after the opening <body>
tag:
<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>`
And then I place the code for my plugin wherever want it to appear on my page but I see just nothing? What's happening?
<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>
回答1:
My answer is late, but its worthful, I faced same issue after researching it many hours I made it work in following way. Give it try and It works for you. You can customize options of iframe
i.e width, show_facepile, small_header etc
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>
来源:https://stackoverflow.com/questions/33710826/facebook-new-like-box-page-plugin-not-working