将 Facebook 加载到 iframe 中 [英] Load Facebook into an iframe

查看:29
本文介绍了将 Facebook 加载到 iframe 中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法将 facebook 加载到 iframe 中,在如下所示的网页中:

<头><!-- 这里有些东西--><身体><!-- 这里有些东西--><iframe src="http://www.google.com" frameborder="0"></iframe>

我已经在其他网站上对其进行了测试,它似乎可以正常加载,例如对于 wired.com,但对于 facebook.com...>

谁能解释一下为什么?

如果需要,我正在使用 Google Chrome 和 Safari.

似乎 Google 阻止了其页面的 iframe 加载.

解决方案

如果你使用 Firebug 或 Google Chrome 的开发者控制台,你会看到以下错误

拒绝显示文档,因为 X-Frame-Options 禁止显示.


X-Frame-Options

<块引用>

拒绝
无论站点如何尝试,都无法在框架中显示该页面.

SAMEORIGIN
页面只能显示在与页面本身相同来源的框架中.

这是另一个相关的stackoverflow问题克服X-Frame-Options 禁止显示"

I can't load facebook into an iframe, in a web page like the following one:

<html>
<head>
<!-- some stuffs here -->
</head>
<body>
<!-- some stuffs here -->
<iframe src="http://www.google.com" frameborder="0">
</iframe>
</body>
</html>

I've tested it with other websites and it seems to load without problems for instance for wired.com, but not for facebook.com...

Can anyone explain me why?

I'm using Google Chrome and Safari, if needed.

It seems to be as if Google blocks iframe loading of its page.

解决方案

If you use Firebug or Google Chrome's developer console, you can see the following error

Refused to display document because display forbidden by X-Frame-Options.


X-Frame-Options

DENY
The page cannot be displayed in a frame, regardless of the site attempting to do so.

SAMEORIGIN
The page can only be displayed in a frame on the same origin as the page itself.

Here is another related stackoverflow question Overcoming "Display forbidden by X-Frame-Options"

这篇关于将 Facebook 加载到 iframe 中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆