繁体   English   中英

流星错误:找不到Content-Security-Policy元标记。 使用cordova-plugin-whitelist插件时,请添加一个

[英]Meteor error: No Content-Security-Policy meta tag found. Please add one when using the cordova-plugin-whitelist plugin

我现在已经用Meteor构建了一个应用程序几个星期了,没有任何问题。 昨天我也没有任何问题。 今天,我想继续构建我的应用程序,终端每10秒会给我这个错误:

I20151208-11:19:04.463(1) (android:file:///android_asset/www/plugins/cordova-plugin-whitelist/whitelist.js:25) No Content-Security-Policy meta tag found. Please add one when using the cordova-plugin-whitelist plugin.

所以我尝试运行另一个Meteor项目,并得到了相同的错误。

我用谷歌搜索了这个错误,它说我必须在项目中更改config.xml。 我不知道config.xml在Meteor项目中的位置,但是由于该错误正在显示给我尝试运行的所有项目,因此我认为这不是解决方案。

谁能帮我解决这个问题?

编辑:我在Meteor项目的<head>标记和.meteor / local / cordova-build / www / index.html文件的<head>标记中添加了以下行:

<meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *">

另外,我将此添加到我的.meteor / local / cordova-build / config.xml中:

<allow-navigation href="*" />

这到我的mobile-config.js文件中:

App.accessRule('*');

没有成功 :(

请将此代码添加到您的index.html标头中

<meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *">

解决了! 重新启动我的电话,就解决了问题!

暂无
暂无

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

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