违反了内容安全策略指令:img-src *'self'数据:https:“

时间:2019-01-23 06:58:34

标签: html html5 vue.js content-security-policy

我正在尝试从服务器中获取dynamic张图片,而我得到了这些errors。 首先,我得到

Content Security Policy directive: "default-src *". Note that 'img-src' was not explicitly set, so 'default-src' is used as a fallback.

我的内容是:

<meta http-equiv="Content-Security-Policy" content="default-src *;  'self' 'unsafe-inline' 'unsafe-eval' data: gap: content:">

然后我搜索了stackoverflow,并将内容更改为:

<meta http-equiv="Content-Security-Policy" content="default-src *;
   img-src * 'self' data: https:; script-src 'self' 'unsafe-inline' 'unsafe-eval' *;
   style-src  'self' 'unsafe-inline' *">

violates the following Content Security Policy directive: "img-src * 'self' data: https:".

1 个答案:

答案 0 :(得分:0)

我通过注释掉该行来解决该问题。这可能也对您有用。