我无法将 facebook 加载到 iframe 中,在如下网页中:
<html>
<head>
<!-- some stuffs here -->
</head>
<body>
<!-- some stuffs here -->
<iframe src="http://www.google.com" frameborder="0">
</iframe>
</body>
</html>
我已经在其他网站上对其进行了测试,它似乎可以毫无问题地加载,例如 wired.com
,但 facebook.com
...
谁能解释一下为什么?
如果需要,我会使用 Google Chrome 和 Safari。
Google 似乎阻止了其页面的 iframe 加载。
最佳答案
如果您使用 Firebug 或 Google Chrome 的开发者控制台,您会看到以下错误
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.
这是另一个相关的 stackoverflow 问题 Overcoming “Display forbidden by X-Frame-Options”
关于html - 将 Facebook 加载到 iframe,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9680215/