我有一个使用google apis的apache cordova应用程序,即angular.module('...')
.directive('repeatDone', function($timeout) {
return function(scope, element, attrs) {
function initWrapper(){
$('...').DataTable();
}
if (scope.$last) {
$timeout(initWrapper,200);
}
}
})
。在我的www.googleapis.com
我已将CSP设置如下
index.html
我的<meta http-equiv="Content-Security-Policy" content="default-src 'self' 'unsafe-inline' 'unsafe-eval' www.googleapis.com data: gap: https://ssl.gstatic.com ">
看起来如下
config.xml
在浏览器中构建和运行此应用程序按预期工作,即我可以访问和使用谷歌API。但是,在android模拟器(intel x86)中构建和运行应用程序会给我以下错误
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.myapp.www" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>MyApp</name>
<description>
A sample Apache Cordova application that responds to the deviceready event.
</description>
<author email="dev@cordova.apache.org" href="http://cordova.io">
Apache Cordova Team
</author>
<content src="index.html" />
<plugin name="cordova-plugin-whitelist" spec="1" />
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<platform name="android">
<allow-intent href="market:*" />
</platform>
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
</platform>
</widget>
这与模拟器有关吗?模拟器可以调用google apis吗?或者,我是否忽略了在Refused to coonect to 'https://www.googleapis.com/.... because it violates the following Content Security Policy directive: "default-src 'self' 'unsafe-inline' 'unsafe-eval' www.googleapis.com data: gap: https://ssl.gstatic.com ". Note that 'connect-src' was not explicitly set, so 'default-src' is used as a fallback.
中做某事?