html - iframe 拒绝显示

标签 html iframe

我正在尝试将一个简单的 iframe 加载到我的网页之一,但它没有显示。我在 Chrome 中收到此错误:

Refused to display 'https://cw.na1.hgncloud.com/crossmatch/index.do' in a frame because an ancestor violates the following Content Security Policy directive: "frame-ancestors 'self' https://cw.na1.hgncloud.com".


Invalid 'X-Frame-Options' header encountered when loading 'https://cw.na1.hgncloud.com/crossmatch/index.do': 'ALLOW-FROM https://cw.na1.hgncloud.com' is not a recognized directive. The header will be ignored.

这是我的 iframe 的代码:

<p><iframe src="https://cw.na1.hgncloud.com/crossmatch/" width="680" height="500" frameborder="0"></iframe></p>

我不太确定那是什么意思。我以前加载过很多 iframe,但从未收到过此类错误。

有什么想法吗?

最佳答案

这意味着位于 cw.na1.hgncloud.com 的 http 服务器发送一些 http header 来告诉像 Chrome 这样的网络浏览器允许 iframe 仅从一个页面加载该页面 (https://cw.na1.hgncloud.com/crossmatch/)托管在同一域 (cw.na1.hgncloud.com) 上:

Content-Security-Policy: frame-ancestors 'self' https://cw.na1.hgncloud.com
X-Frame-Options: ALLOW-FROM https://cw.na1.hgncloud.com

你应该阅读:

关于html - iframe 拒绝显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31944552/

相关文章:

php - 使用html和php将图像上传到mysql

javascript - 没有框架的 Twitter Bootstrap Navigation

javascript - 从 iframe 动态创建的元素上的事件绑定(bind)

javascript - 在 PhantomJS 中,page.switchToFrame(k) 是否需要延迟才能调用 page.evaluate() 来识别新框架的文档?

html - bootstrap hidden-xs 不工作

html - 如何使用 VBA 单击网站上的组合框

javascript - 从 FOR 循环生成的 SELECT 列表中选择 OPTION

javascript - 无法在 Javascript 书签中正确定位 iFrame

java - 如何从java代码访问iframe元素

jquery - 如何禁用 iframe 中的文本框