我试图在我的网页中加载一个简单的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,从未遇到这样的错误。
有任何想法吗?
src
属性中使用的资源是否应该发送Content-Security-Policy
? - OlehZiniakX-Frame-Options
一起使用的ALLOW-FROM
现已过时。您应该优先考虑上述提到的Content-Security-Policy
。 - Ian JamiesonContent-Security-Policy
包含允许的URLmy-site.com:*
,但我尝试将www.my-site.com
设置为iframe的src
属性。所以,这三个字母WWW是问题所在。 - MegaCasper