简体   繁体   English

Cordova InAppBrowser executeScript回调

[英]Cordova InAppBrowser executeScript callback

I try to parse some site and execute script in Cordova InAppBrowser's method executeScript on iOS and return some result in callback function, but get this error: 我尝试在iOS上的Cordova InAppBrowser的方法executeScript解析一些站点并执行脚本,并在回调函数中返回一些结果,但是出现此错误:

Refused to load gap-iab://InAppBrowser1249228873/%5Bnull%5D because it does not appear in the frame-src directive of the Content Security Policy. 拒绝加载gap-iab:// InAppBrowser1249228873 /%5Bnull%5D,因为它没有出现在内容安全策略的frame-src指令中。

I understand, that gap-iab:// scheme should be included to Content Security Policy in <meta> tag, but code is executing not on my site and I don't have access to it. 我知道, gap-iab://方案应包含在<meta>标记中的内容安全策略中,但是代码不在我的网站上执行,并且我无法访问它。

Can anyone suggest a decision to resolve this problem? 谁能建议解决这个问题的决定?

PS On Android executeScript works perfectly. PS在Android上的executeScript完美运行。

You could use nginx to proxy the HTML page you are trying to load. 您可以使用nginx代理要加载的HTML页面。 You'd set up nginx to proxy the site you are loading in the InAppBrowser, and use the add-header to add a Content-Security-Policy in the response with "'default-src' gap: gap-iab:" 您将设置nginx来代理要在InAppBrowser中加载的网站,并使用add-header在响应中添加内容安全策略,并带有“'default-src'差距:gap-iab:”

The one issue you may have is if the original server already includes a strict Content-Security-Policy, because the strictest content-security-policy will get applied. 您可能遇到的一个问题是,如果原始服务器已经包含严格的Content-Security-Policy,则将应用最严格的Content-Security-Policy。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM