html - 带有外部页面的 iframe 不工作

标签 html iframe

我想在 iframe 中嵌入一个网页,但它根本不起作用。具有相对路径的内部页面正常显示。但是这个简单的代码不起作用:

<iframe src="http://www.google.com/"></iframe>

应该显示 iframe 的地方是空的。我查看了页面源代码,之后什么都没有

这怎么可能?

最佳答案

Google 使用 X-FRAME-OPTIONS HTTP header 禁止将其页面放入 iframe: https://developer.mozilla.org/en/The_X-FRAME-OPTIONS_response_header

几乎所有现代浏览器都会拒绝将带有此 HTTP header 的页面放入 iframe 中。您对此无能为力。

关于html - 带有外部页面的 iframe 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9158024/

相关文章:

html - 变换 : scale - dealing with remaining 'margin' of initial size

php - 如何在 Yii 的 chtml::image htmloptions 中添加非 HTML 属性

html - 使用 bootstrap 3 从左侧到顶部的导航栏

iphone - 如何解析 Objective-C 中 iframe 标签的 src 属性?

iframe - 如何更改disqus评论的字体

javascript - 使用 Javascript 以编程方式单击 iframe 中的链接

html - CSS悬停div1.img1影响另一个div2.img2

javascript - HTML 标签和 HTML 对象有什么区别?

javascript - eekTo() 不是函数 YouTube iframe API 错误

javascript - 如何关闭自身内部的 iframe?