Electron 中 lordicon 无法显示

Electron 中 lordicon 无法显示 报错1:electron properties of undefined (reading ‘effects

Electron 中 lordicon 无法显示

报错1:electron properties of undefined (reading ‘effectsManager’

调试发现是src="https://cdn.lordicon.com/*.json"未加载导致。但被try catch了

实际报错: ‘unsafe-eval’ is not an allowed

Uncaught EvalError: Refused to evaluate a string as JavaScript because ‘unsafe-eval’ is not an allowed source of script in the following Content Security Policy directive: “script-src ‘self’”.

违反了Content Security Policy指令。

<meta  http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline'"/>

临时解决

添加 unsafe-eval

其他 Refused to connect to XXX

that ‘connect-src’ was not explicitly set, so ‘default-src’ is used as

Refused to load the image 'data:image/svg+xml,%3csvg

参考

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy