ios - 内容安全策略框架祖先。 Iframe 不会在 iOS10 中加载内容

标签 ios cordova iframe ios10 content-security-policy

我们的 Cordova 应用程序不会在 iOS 10 上加载 iframe 内容。

我们有一些 iframe 在应用程序中显示来 self 们网页的某些信息,因此我们不必复制它们。

在以下任何 iOS 版本中都可以正常工作。但是自从我们的设备更新后,应用程序拒绝加载资源。

Refused to load http://.../.../X.html because it does not appear in the frame-ancestors directive of the Content Security Policy

我曾尝试编辑我的元 Content-Security-Policy 标签以允许来自该资源,但这没有用。我想这个问题是关于网络服务器告诉我的应用程序/浏览器不允许这个来源的,但遗憾的是我对那个话题没有那么深入。我所知道的是网络服务器将 X-Frame-Options 设置为 SAMEORIGIN,但这也应该为其他 iOS 版本禁用它。

那么在这种情况下我该如何绕过安全配置,使其像在早期版本的 iOS 中一样工作?

如果您需要更多信息,请告诉我,我不知道是否遗漏了什么。

最佳答案

What I know is that the web server sets the X-Frame-Options to SAMEORIGIN, but that should disable it for the other iOS versions as well.

除了现有的标题:

X-Frame-Options: SAMEORIGIN

添加等效的内容安全策略:

Content-Security-Policy: frame-ancestors 'self'

请牢记以下注意事项:

A word about support. Not supported in all browsers yet, Chrome 40+ and FF 35+ support, but will also default to X-Frame-Options if it exists. Spec says, CSP should take precedence. This will not work when CSP is in a <meta> tag, and will not work when using Content-Security-Policy-Report-Only.

引用资料

关于ios - 内容安全策略框架祖先。 Iframe 不会在 iOS10 中加载内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39742211/

相关文章:

javascript - 如何隐藏 Microsoft Office Online Viewer 中的状态栏

ios - 如何设置 iOS UITextField 占位符颜色? (RubyMotion + iOS)

ios - setlocale() 在 iOS 模拟器中不起作用?

ios - React native - 连接没有连接处理程序错误含义?

javascript - 在 Phonegap 中以编程方式加载 Admob 插页式广告

jquery - 在 iFrame 中隐藏滚动条

iFrame 在 WordPress 和 SEO 上嵌入视频

ios - OpenCV 错误 : Assertion failed on iOS

android - Phonegap 在 Android 模拟器中不工作

ios - 删除 IOS 不工作的联系 Cordova 2.5