我们使用 iframe 在浏览器上加载 FBFrame,它在 Google Chrome 上加载,但在 safari 上它给出以下代码:
错误 拒绝在框架中显示“https://www.facebook.com/login/?next=https%3A%2F%2Fwww.facebook.com%2F”,因为它将“X-Frame-Options”设置为“DENY” .
下面是代码:
<script>
function setupFBframe(frame) {
if (frame.src) return;
var container = frame.parentNode;
var containerWidth = container.offsetWidth;
var containerHeight = container.offsetHeight;
var src =
"https://www.facebook.com/plugins/page.php" +
"?href=https%3A%2F%2Fwww.facebook.com%2Fnetwork21international" +
"&tabs=timeline" +
"&width=" +
containerWidth +
"&height=" +
containerHeight +
"&small_header=true" +
"&adapt_container_width=false" +
"&hide_cover=true" +
"&hide_cta=true" +
"&show_facepile=false" +
"&appId";
frame.width = containerWidth;
frame.height = containerHeight;
frame.src = src;
}
var facebookIframe;
// Why resizeThrottler? See more : https://developer.mozilla.org/ru/docs/Web/Events/resize
(function () {
setupFBframe(facebookIframe);
})();
</script>
<iframe id="facebook_iframe" class="facebook_iframe" onload="facebookIframe = this; setupFBframe(facebookIframe)"></iframe>