1
我有一个PhoneGap应用程序,它从我的服务器获取数据,并且我已经设置了所有与跨域资源一起工作的应用程序。Phonegap和Android 4.4.2白名单不工作
它在Android 4.0.3上正常工作,然后我在Android 4.4.2上测试它,它不起作用!在Ajax调用我收到
An error occured: 0 SecurityError:
Failed to execute "open" on "XMLHttpRequest": refused to connect to "domain.com" because it violates the document's Content Security Policy.
我的config.xml文件包含以下内容:
<plugin name="cordova-plugin-whitelist" version="1"/>
<access origin="http://domain.com/app-filelanding/*" />
<allow-intent href="http://*/*"/>
<allow-intent href="https://*/*"/>
<allow-intent href="tel:*"/>
<allow-intent href="sms:*"/>
<allow-intent href="mailto:*"/>
<allow-intent href="geo:*"/>
我有这个元标记在我的index.html
<meta http-equiv="Content-Security-Policy"
content="default-src 'self' http://www.domain.com 'unsafe-inline' data: gap: https://ssl.gstatic.com;
media-src *;
connect-src 'http://www.domain.com/'">
这在我的脚本上:
$(document).on("mobileinit", function(){
$.support.cors = true;
$.mobile.allowCrossDomainPages = true;
});
你可以尝试删除周围的“http报价: //www.domain.com/“? – CyrilleGuimezanes