我想用我的网站上嵌入谷歌的字体和我已经包含下载谷歌从字体API的字体,每次有人访问该网站的链接,而是因为它好像我有Firefox的一个问题,它的尝试每次下载字体刷新或点击一个新的链接。

在所有其他浏览器只通过了像任何其他缓存的东西网站下载一次,缓存的字体。

到谷歌字体API样式表的链路如下:

<link href='http://fonts.googleapis.com/css?family=Droid+Sans&subset=latin' rel='stylesheet' type='text/css'>
有帮助吗?

解决方案

我注意到相同的行为;加载使用JavaScript的字体似乎解决了问题。只需更换“Ubuntu的”与“的Droid”你的情况和你的<head>标记之后插入下面的代码块:

<script type="text/javascript">
  WebFontConfig = {
    google: { families: [ 'Ubuntu' ] }
  };
  (function() {
    var wf = document.createElement('script');
    wf.src = ('https:' == document.location.protocol ? 'https' : 'http') +
        '://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';
    wf.type = 'text/javascript';
    wf.async = 'true';
    var s = document.getElementsByTagName('script')[0];
    s.parentNode.insertBefore(wf, s);
  })();
</script>

更多信息可以在这里找到在谷歌开发者 '字体站点。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top