【发布时间】:2016-02-04 22:01:48
【问题描述】:
我正在尝试使用以下代码将网站嵌入到另一个网站:
<iframe width="100%" height="100%" src="http://www.petarvasilev.com/"></iframe>
这失败了,我在控制台中收到以下错误
Refused to frame 'http://www.petarvasilev.com/' because it violates the following Content Security Policy directive: "default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'". Note that 'frame-src' was not explicitly set, so 'default-src' is used as a fallback.
Here 是一个可以试用的 JsFiddle。
我检查了 X-Frame-Options 标题,但我的网站没有发送一个,这让我忘记了它为什么不起作用。任何帮助表示赞赏:)
【问题讨论】:
-
奇怪的是这条线对我来说很好用,你有没有试过在系统的本地文件上运行
<iframe width="100%" height="100%" src="http://www.petarvasilev.com/"> </iframe>。