html - Google 字体违反内容安全政策

标签 html css http google-font-api content-security-policy

我正在尝试使用 Google 字体,我从来没有遇到过任何问题,但现在当我尝试在我的页眉上添加 CSS 文件时,我在控制台上收到此错误:

拒绝加载样式表 'http://fonts.googleapis.com/css?family=Whatever' 因为它违反了以下内容安全策略指令:"style-src ' self' '不安全内联'”

最佳答案

这里有两件事需要解决:

  • 为 Google 字体链接使用 https (https://fonts.googleapis.com/css?family=Whatever)
  • 授权 https://fonts.googleapis.comstyle-src 指令和 https://fonts.gstatic.comfont-src 指令:"style-src 'self' https://fonts.googleapis.com; font-src 'self' https://fonts.gstatic.com"

关于html - Google 字体违反内容安全政策,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33984908/

相关文章:

c - 需要返回什么 HTTP header 以便 Web 浏览器使用建议的文件名? (文件从 CGI 中下载)

android - 频繁的http请求

jquery - Bootstrap Carousel - 每张幻灯片拆分和显示四张图片时出现问题。

html - div 元素行为不当

css - 网站内的绝对与相对元素定位

html - 如何制作帖子标题装饰

jquery - Owl Carousel 显示后的停用延迟加载

javascript - ExtJs FormPanel - 如何使用内联声明的按钮提交表单?

jquery - 谷歌浏览器不会在单选按钮上触发模糊事件?

html - 使用翻译时缩小屏幕时停止 div 移出页面