首页 > 解决方案 > 离子科尔多瓦如何设置worker-src?

问题描述

我正在尝试为我的科尔多瓦应用程序设置 worker-src。当我为浏览器构建科尔多瓦时,它显示

plugin.min.js:582 Refused to create a worker from 
'blob:http://localhost:8000/a641e3c9-53b6-4a67-bf4f-281a66e78530'
because it violates the following Content Security Policy 
directive: "script-src * 'unsafe-inline' 'unsafe-eval'". 
Note that 'worker-src' was not explicitly set, so 'script-src' 
is used as a fallback

所以我尝试通过设置 worker-srchttps://content-security-policy.com/但他们没有类似worker-src. 我该如何解决这个问题?任何想法将不胜感激。谢谢。

标签: cordovaionic4

解决方案


您应该使用 child-src 而不是 worker-src 例如。是

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

推荐阅读