【发布时间】:2021-09-27 09:21:34
【问题描述】:
我在 Electron 开发者控制台中收到一堆内容安全策略错误,用于添加谷歌字体:
拒绝加载样式表“https://fonts.googleapis.com/css2?family=Inter:wght@300;400&display=swap”,因为它违反了以下内容安全政策指令:“default-src 'self' '不安全的内联'数据:"。请注意,'style-src-elem' 没有显式设置,因此 'default-src' 用作后备。
我正在使用 electron-forge 的 React 和 TypeScript 样板。
【问题讨论】:
-
我最终下载了字体并加载了它们from the project。