【发布时间】:2013-03-27 16:28:27
【问题描述】:
这是一个非常令人沮丧的错误!
我正在使用Font Awesome(本地托管)和其他几种字体,它们间歇性地无法加载 - 不是 404ing,只是完全没有出现在开发者工具的“网络”选项卡中,并且没有在页。
这似乎最常发生在第一次加载页面时 - 刷新字体然后加载/渲染 OK。但是,清除浏览器缓存并不能可靠地重现该问题。
我知道路径没问题,因为大约 80% 的时间字体呈现正常。这是一个间歇性问题。我在 OSX 上使用 Chrome v26。
我的 CSS 如下所示:
<head>
...
<link rel="stylesheet" type="text/css" href="${context}/resources/font/opensans.css" />
<link rel="stylesheet" type="text/css" href="${context}/resources/css/font-awesome.min.css" />
...
CSS 文件如下所示:
@font-face {
font-family: 'open_sanslight';
src: url('opensans-light-webfont.eot');
src: url('opensans-light-webfont.eot?#iefix') format('embedded-opentype'),
url('opensans-light-webfont.woff') format('woff'),
url('opensans-light-webfont.ttf') format('truetype'),
url('opensans-light-webfont.svg#open_sanslight') format('svg');
font-weight: normal;
font-style: normal;
}
再一次,路径是正确的(这可以从大约 80% 的时间字体正确呈现的事实证明)。
可能发生了什么?
【问题讨论】:
-
你在查看网络标签@firefox吗?一样吗?
-
我没有注意到 Firefox 中的问题,我现在无法重现它(实际上我在 Firefox 中禁用了缓存,所以如果有的话应该会更糟)。就像我说的:莫名其妙。
标签: css browser font-face webfonts