某些Facebook页面的插件无法嵌入。某些原因似乎是令人反感的内容,另一个原因是受隐私限制的页面。 (这是一个类似的问题 Facebook Page Plugin is not working - only for one site)
一个插件是站点插件:https://developers.facebook.com/docs/plugins/page-plugin#privacy
如何检查页面是否限制为不显示空白iframe?
这是我要用图像或段落替换(jquery)的示例iframe,因为加载的iframe为空,因为页面受到限制。
(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 = 'https://connect.facebook.net/de_DE/sdk.js#xfbml=1&version=v3.2';
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
$(document).ready(function(){
var bh = 0;
$(".holder").css('width', $("#ReinekeFuchsCologneEVENTS").css("width"));
$(".bar").css('width', $("#ReinekeFuchsCologneEVENTS").css("width"));
bh = $("#ReinekeFuchsCologne").css('height');$(".bar").css('height', bh); $("#ReinekeFuchsCologneEVENTS").hide(); $("#ReinekeFuchsCologneCLICK").css('width', $("#ReinekeFuchsCologneEVENTS").css("width")); $("#ReinekeFuchsCologneCLICK").click(function s(){ $("#ReinekeFuchsCologne").toggle(); $("#ReinekeFuchsCologneEVENTS").toggle();
$("#ReinekeFuchsCologneCLICK").css('height', bh);
});
});
.bar{
position:absolute;
top:0;
# left:0;
width:100%;
height:100%;
opacity: 0.2;}
.bar:hover{
background: red;
}
.bar:after {
content: "Here should be appear the content of iframe of the Facebook Page or an alternativ error splash screen";
}
.holder{
vertical-align: top;
white-space: normal;
float: left;
position:relative;
}
.frame{
width: 100%;
height:100%;
background :blue;
}
.container{
display: inline-block; }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div id="fb-root"></div>
<div class="holder">
<iframe id="ReinekeFuchsCologneEVENTS" src="https://www.facebook.com/plugins/page.php?href=https%3A%2F%2Fwww.facebook.com%2Fpg%2FReinekeFuchsCologne&tabs=events&width=500&height=499&small_header=true&adapt_container_width=true&hide_cover=false&show_facepile=false&appId" width="500" height="499" style="border:none;overflow:hidden;" scrolling="no" frameborder="0" allowTransparency="true" allow="encrypted-media"></iframe>
<div id="ReinekeFuchsCologneCLICK" class="bar"></div>
<iframe id="ReinekeFuchsCologne" src="https://www.facebook.com/plugins/page.php?href=https%3A%2F%2Fwww.facebook.com%2FReinekeFuchsCologne%2F&tabs&width=500&height=70&small_header=true&adapt_container_width=true&hide_cover=false&show_facepile=false&appId" width="500" height="70" style="border:none;overflow:hidden;" scrolling="no" frameborder="0" allowTransparency="true" allow="encrypted-media"></iframe>
</div><!--end of Holder-->