font-src:内容安全策略(CSP, Content Security Policy)中的一条指令,用来规定网页允许从哪些来源加载字体资源(如 .woff2、.woff、.ttf 等)。它通常出现在 Content-Security-Policy HTTP 响应头或 <meta http-equiv="Content-Security-Policy"> 中。(也可用于限制 data:、https: 等来源;不同浏览器与规范版本对细节支持略有差异。)
/ˈfɑːnt sɝːs/
The site uses font-src 'self' to load fonts only from its own domain.
该网站使用 font-src 'self' 让字体只能从自身域名加载。
To fix the console error, we updated the policy to font-src 'self' https://fonts.gstatic.com so the page can use Google-hosted fonts securely.
为了解决控制台报错,我们把策略改为 font-src 'self' https://fonts.gstatic.com,让页面能在更安全的前提下使用托管在 Google 的字体。
font-src 是由 font(字体)+ src(source 的缩写,来源)组合而成的技术写法,属于 CSP 指令命名风格(如 script-src、img-src)。其中连字符 - 用于把“资源类型”和“来源限制”连接成一个可读的配置项名称。
font-src 等指令)