我有一个 Cordova 应用程序,在升级(5.0.0)后,我无法调用任何资源。我已经添加了白名单插件,并在 index.html 中添加了以下标记。
<meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval' *.azure-mobile.net localhost:1337 *.ajax.aspnetcdn.com">
我遇到了以下错误:
拒绝加载脚本 'http://ajax.aspnetcdn.com/ajax/mobileservices/MobileServices.Web-1.2.5.min.js',因为它违反了以下内容安全策略指令:“script-src 'self' 'unsafe-inline' 'unsafe-eval' *.azure-mobile.net localhost:1337 *.ajax.aspnetcdn.com”。
拒绝加载脚本 'http://localhost:1337/vorlon.js',因为它违反了以下内容安全策略指令:“script-src 'self' 'unsafe-inline' 'unsafe-eval' *.azure-mobile.net localhost:1337 *.ajax.aspnetcdn.com”。
我已经尝试了默认策略,应该允许一切,但还是没有成功。
我还在我的config.xml文件中添加了以下内容
<access origin="*" />
<allow-navigation href="*" />
并使用以下插件:
C:\Projects\TavlaApp>cordova plugin
com.microsoft.azure-mobile-services 1.2.7 "Windows Azure Mobile Services"
cordova-plugin-whitelist 1.0.1-dev "Whitelist"
nl.x-services.plugins.calendar 4.3.4 "Calendar"
nl.x-services.plugins.insomnia 4.0.1 "Insomnia (prevent screen sleep)"
org.apache.cordova.inappbrowser 0.6.0 "InAppBrowser"
有什么想尝试的主意吗?
*://192.168.2.2
)时,在Chrome调试器中出现了“无效来源”错误。 - JoshuaDavid