【问题标题】:it violates the following Content Security Policy directive它违反了以下内容安全政策指令
【发布时间】:2016-01-14 20:00:09
【问题描述】:

我刚开始学习 Cordova。我根据this url创建了一个项目。这个项目在Ripple模拟器中运行正常。但是当我尝试在Google Android Emulator中运行它时。它无法获取天气,并显示以下信息:

Refused to connect to 'https://query.yahooapis.com/v1/public/yql?q=select+*+from+weather.forecast+where+location=98052&format=json' because it violates the following Content Security Policy directive: "default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'". Note that 'connect-src' was not explicitly set, so 'default-src' is used as a fallback.

jquery-2.1.4.min.js (4,14349)

我是否应该采取其他措施让这个项目在 Google Android Emulator 中正常运行。

【问题讨论】:

  • 感谢 Lakhan 帮助编辑此问题。

标签: cordova-2.0.0


【解决方案1】:

检查一下:

http://content-security-policy.com/#source_list

修复:

在源应用目录中:

www\index.html

https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline';媒体源 *">

我把'self'改成'*'

content="default-src *

【讨论】:

    猜你喜欢
    • 2021-03-14
    • 1970-01-01
    • 2016-07-19
    • 2021-05-10
    • 2016-03-03
    • 2020-06-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多