【发布时间】:2016-10-28 07:18:29
【问题描述】:
我更新了 phonegap build 6.3.4 (Cordova 6.4.0)。到目前为止,对服务器的所有 ajax 调用都运行良好。它突然停止了。
我在 iOS 构建中遇到了类似的情况,它变成了 Content-Security-Policy 的新增内容。我想知道是否为 Android 添加了任何内容?
最后,是否有关于要添加的内容安全标签的适当信息?
插件
cordova-plugins-whitelist
config.xml
<access origin="http://*" />
<access origin="https://*" />
<allow-navigation href="*" />
<allow-intent href="*" />
index.html
<meta http-equiv="Content-Security-Policy" content="img-src * 'self' data:; default-src * 'self' gap: wss: ws: ; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval';">
【问题讨论】:
-
尝试使用白名单插件
https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-whitelist/并允许您的域 -
<allow-navigation href="http://example.com/*" />或<allow-navigation href="http://*/*" /> -
嗨,我已经有 cordova-plugin-whitelist .. 但我没有在允许导航中添加所有域
-
您尝试过添加导航吗?它对您有用吗?
-
对不起,如果我之前没有说清楚。我已经安装了cordova-plugin-whitelist。这个标签存在于我的配置中
这一直有效,直到最后一次构建(大约一周前)
标签: android jquery ajax cordova phonegap-build