gpt4 book ai didi

css - 字体间歇性加载失败?

转载 作者:行者123 更新时间:2023-11-28 09:38:23 25 4
gpt4 key购买 nike

这是一个非常令人沮丧的错误!

我正在使用 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% 的时间内正确呈现)。

可能发生了什么?

最佳答案

同样的问题。似乎只影响 Chrome。 Chromium 中的这个错误似乎描述了相同的问题(或非常相似的问题):

https://code.google.com/p/chromium/issues/detail?can=2&start=0&num=100&q=font&colspec=ID%20Pri%20M%20Iteration%20ReleaseBlock%20Cr%20Status%20Owner%20Summary%20OS%20Modified&groupby=&sort=-modified&id=229071

我们目前假设这是一个浏览器错误,尽管它似乎只影响我们的一些网站而不影响其他网站,所以可能不止于此。

以下是我们尝试过但没有成功的一些方法:

  • 从 Bootstrap CDN 而不是我们自己的服务器加载字体 (FontAwesome)。仍然间歇性地失败。
  • 将字体文件内联为 base64 编码字符串。仍然间歇性地失败。
  • 从 FontAwesome 切换到 SymbolSet。仍然间歇性地失败。

关于css - 字体间歇性加载失败?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15830843/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com