【发布时间】:2019-09-05 11:18:16
【问题描述】:
我想在我的 PHP 网页中嵌入一个 OpenStreetMap iframe;但我在任何网络浏览器中都有这种错误:
Content Security Policy: « x-frame-options » ignored due to the directive « frame-ancestors ».
但我确实添加了这段代码:
header( 'Content-Security-Policy: frame-ancestors openstreetmap.org' ) ;
我也看过这里(但没有帮助):
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/frame-ancestors
https://developer.mozilla.org/fr/docs/Web/HTTP/Headers/X-Frame-Options
https://openweb.eu.org/articles/content-security-policy(法语)
怎么了?
谢谢
【问题讨论】:
-
错误消息只是告诉您指定
frame-ancestors优先于x-frame-options,当两者都设置时。但是你不能从你的最后添加这个 - OSM 是必须允许他们的内容显示在你的 iframe 中的那个。如果这不起作用,那么也许您没有选择正确的资源开始嵌入? -
是的,非常感谢!
标签: php content-security-policy