android – Phonegap错误 – “找不到Content-Security-Policy元标记.使用cordova-plugin-whitelist插件时请添加一个.“

前端之家收集整理的这篇文章主要介绍了android – Phonegap错误 – “找不到Content-Security-Policy元标记.使用cordova-plugin-whitelist插件时请添加一个.“前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

即使在阅读了关于这个主题的所有SO帖子之后,也很难解决这个问题,但是这一点很难实现.

我安装了org.apache.cordova.whitelist插件,我在index.html文件添加了Content-Security-Policy元指令,并在config.xml中添加了相应的和标签.但是,每次我运行应用程序(Android)时都会收到以下错误

“No Content-Security-Policy Meta tag found. Please add one when using
the cordova-plugin-whitelist plugin.”,source:
file:///android_asset/www/plugins/cordova-plugin-whitelist/whitelist.js

这是非常基本的索引页面

required by applicable law or agreed to in writing,software distributed under the License is distributed on an
    "AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY
     KIND,either express or implied.  See the License for the
    specific language governing permissions and limitations
    under the License.
-->
Meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src: 'self' 'unsafe-inline' 'unsafe-eval'" />
        <Meta charset="utf-8" />
        <Meta name="format-detection" content="telephone=no" />
        <Meta name="msapplication-tap-highlight" content="no" />
        <Meta name="viewport" content="user-scalable=no,initial-scale=1,maximum-scale=1,minimum-scale=1,width=device-width,height=device-height,target-densitydpi=device-dpi" />
        

这是config.xml:

最佳答案
仅用于测试目的:注释掉这一行 – >

< meta http-equiv =“Content-Security-Policy”content =“default-src *; style-src'self''unsafe-inline'; script-src:'self''unsafe-inline''unsafe-eval '“/>

比你的问题消失了.

您可以在此处找到有关白名单的其他信息:Cordova Plugin – Whitelist

猜你在找的jQuery相关文章