Firefox未从Google Font API渲染字体



我上传了一个我们公司外包的登录页,Firefox没有呈现Lato字体,而是回到了底层。

我们收到了以下来自fonts.googleapis.com的样式表。

@font-face {
  font-family: 'Lato';
  font-style: normal;
  font-weight: 700;
  src: local('Lato Bold'), local('Lato-Bold'), url(https://themes.googleusercontent.com/static/fonts/lato/v6/wkfQbvfT_02e2IWO3yYueQ.woff) format('woff');
}
@font-face {
  font-family: 'Lato';
  font-style: normal;
  font-weight: 100;
  src: local('Lato Hairline'), local('Lato-Hairline'), url(https://themes.googleusercontent.com/static/fonts/lato/v6/boeCNmOCCh-EWFLSfVffDg.woff) format('woff');
}
@font-face {
  font-family: 'Lato';
  font-style: normal;
  font-weight: 300;
  src: local('Lato Light'), local('Lato-Light'), url(https://themes.googleusercontent.com/static/fonts/lato/v6/KT3KS9Aol4WfR6Vas8kNcg.woff) format('woff');
}
@font-face {
  font-family: 'Lato';
  font-style: normal;
  font-weight: 400;
  src: local('Lato Regular'), local('Lato-Regular'), url(https://themes.googleusercontent.com/static/fonts/lato/v6/9k-RPmcnxYEPm8CNFsH2gg.woff) format('woff');
}

IE、Chrome、Opera和Safari都没有问题。Firefox是否有什么特殊之处,无法显示字体?

我想明白了。我正在使用NoScript插件。它保护我免受来自谷歌的XSS攻击的威胁,即使整个网站都被允许。:D

我将研究noscript中是否有允许使用字体的设置,并将我的发现发布在这里。

这不会给我们的客户带来问题。如果他们自己使用NoScript,他们可能不会为登录页上的字体而烦恼。

编辑:

我能够做到这一点。在NoScript > Options下,我选择了Advanced选项卡和XSS选项卡。然后我添加了以下异常:

^https://themes.googleusercontent.com/static/fonts/lato/v6/[a-zA-Z-_0-9]*.woff$

它比需要的更具体。可以根据需要修剪子文件夹,以允许更多的网站。例如,以下内容应该启用大多数字体:

^https://themes.googleusercontent.com/static/fonts/[/a-zA-Z-_0-9]*.woff$

您是在本地、开发服务器上运行测试,还是类似的东西?检查Firebug的控制台,你应该能够在下载中找到错误,比如404、权限或类似的东西。

如果在Firefox中使用Noscript:打开NoScript选项,转到嵌入选项卡并取消选中:禁止@font face

如中所述:https://developers.google.com/fonts/docs/troubleshooting

最新更新