Phi*_*esi 8 iframe cordova cordova-ios
在构建之间(我不确定是什么改变来触发这个),一个应用程序来自iOS中的以下行为.
index.html,并且有一个iframe,其中包含许多锚点index.html至:
index.html,并且有一个iframe,其中包含许多锚点我安装了最新版本cordova-plugin-inappbrowser(此时为1.3.0),但这似乎并没有干扰任何事情.
我已经验证我仍然可以使用JavaScript index.html来更改框架内锚点的属性,以及添加事件.
我使用以下CSP:
<meta http-equiv="Content-Security-Policy"
content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval';">
我不确定这是否与它有关.
我尝试了一些iframe沙箱属性试图看到什么棒,但没有一个改变结果.目前它位于:
<iframe id="the-iframe" sandbox="allow-scripts allow-modals allow-popups allow-popups-to-escape-sandbox allow-top-navigation allow-forms allow-same-origin"></iframe>
该srciframe的动态设置.
我已经打开了一个关于cordova 的错误报告,看看这是否可能是一个bug而不是一个功能.
我现在正在工作的一个新应用程序遇到了这个问题,这似乎与 Cordova iOS > 6 中的新白名单模式有关。对于我们来说,我已经制定了一个解决方法,允许在 iframe 内导航(我不能确定它是否会产生任何其他问题,但目前我们似乎还没有任何人)。在 cordova 项目中,Private/Plugins/CDVUIWebViewEngine/CDVIntentAndNavigationFilter.m我们刚刚修改了该shouldOverrideLoadWithRequest:navigationType:方法,更改了通过 请求导航时的行为UIWebViewNavigationTypeLinkClicked。
使用新的 Cordova 行为,在这种情况下它会停止导航,并在系统浏览器中打开它;我已经评论了该行 ( [[UIApplication sharedApplication] openURL:url];) 并将返回修改为return YES; 通过这两个更改,它可以像以前版本的 cordova 一样工作:
case UIWebViewNavigationTypeLinkClicked:
// Note that the rejection strings will *only* print if
// it's a link click (and url is not whitelisted by <allow-*>)
if ([self.allowIntentsWhitelist URLIsAllowed:url logFailure:NO]) {
// the url *is* in a <allow-intent> tag, push to the system
//[[UIApplication sharedApplication] openURL:url];
return YES;
} else {
[errorLogs addObject:[NSString stringWithFormat:allowIntents_whitelistRejectionFormatString, [url absoluteString]]];
}
Run Code Online (Sandbox Code Playgroud)
我认为这种行为应该可以通过 config.xml 参数进行配置,但对于我们来说,这种解决方法现在就足够了。