我正试图在我的IONIC应用程序内的iframe中显示我的一个网站。我需要限制我的网站被其他网站iframed。我决定使用content-security-policy响应头,其中
Content-security-policy: frame-ancestors ${website-to-be-allowed}
确保只有提到的网站可以iframe我的网站,但是我需要我的离子应用程序来iframe我的网站,因为离子应用程序是作为文件系统,我可以给所有的文件系统访问iframe我的网站。当我添加
Content-security-policy: frame-ancestors ${website-to-be-allowed} filesystem
正如这里提到的,https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/frame-ancestors
我在我的Android和IOS应用程序上进行了测试,两者都抛出了相同的错误,这表明,
Refused to display ${website} in a frame because an ancestor violates the following content security policy directive: "frame-ancestors filesystem"
下面是弹出enter image description here的错误
发布于 2021-04-23 19:47:20
仅供参考,我使用以下命令使其正常工作:
file://* filesystem:
因此,总体内容安全策略可能如下所示:
Content-Security-Policy: "...; frame-ancestors 'self' file://* filesystem:;
发布于 2019-05-30 23:44:46
你需要在"filesystem“的末尾加上冒号。试一试
frame-ancestors ${website-to-be-allowed} filesystem:
https://stackoverflow.com/questions/56271316
复制相似问题