【问题标题】:ie9 webfonts not loadingie9 webfonts没有加载
【发布时间】:2012-10-30 14:41:22
【问题描述】:

我已经尝试了此处和其他地方提供的所有其他解决方案,但在 ie9 中加载 webfonts 时仍然遇到问题。

对 .htaccess 文件实施了修复:

<FilesMatch "\.(ttf|otf|eot|woff)$">
    <IfModule mod_headers.c>
        Header set Access-Control-Allow-Origin "*"
    </IfModule>
</FilesMatch>

在 ie 开发者控制台中没有收到任何 css3 错误消息。

事情是当初始页面加载时,字体不会加载,但是当我导航到网站上的任何其他页面时,字体就会加载。如果我回到初始页面,字体现在也会加载。

感觉就像我已经尝试了我在网络上能找到的所有东西。

这是我的 CSS:

/** FONTS **/

@font-face {
    font-family: 'UniversUltraCondensedRegular';
    src: url('../fonts/univers-ultracondensed-webfont.eot'); /* IE9 Compat Modes */
    src: url('../fonts/univers-ultracondensed-webfont.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
         url('../fonts/univers-ultracondensed-webfont.woff') format('woff'), /* Modern Browsers */
         url('../fonts/univers-ultracondensed-webfont.ttf')  format('truetype'), /* Safari, Android, iOS */
         url('../fonts/univers-ultracondensed-webfont.svg#UniversUltraCondensedRegular') format('svg'); /* Legacy iOS */
         font-weight: normal;
         font-style: normal;
    }


@font-face {
    font-family: 'WebSymbolsRegular';
    src: url('../fonts/websymbols-regular-webfont.eot'); /* IE9 Compat Modes */
    src: url('../fonts/websymbols-regular-webfont.eot?#iefix') format('embedded-  opentype'), /* IE6-IE8 */
         url('../fonts/websymbols-regular-webfont.woff') format('woff'), /* Modern Browsers */
         url('../fonts/websymbols-regular-webfont.ttf')  format('truetype'), /* Safari, Android, iOS */
         url('../fonts/websymbols-regular-webfont.svg#WebSymbolsRegular') format('svg'); /* Legacy iOS */
         font-weight: normal;
         font-style: normal;
    }

Here's该网站的链接!

谢谢

【问题讨论】:

  • Header set Access-Control-Allow-Origin "*" 存在安全问题。确保在使用之前了解风险。

标签: css fonts internet-explorer-9 font-face webfonts


【解决方案1】:

尝试使用绝对网址

@font-face { font-family: 'UniversUltraCondensedRegular'; src: url('../fonts/univers-ultracondensed-webfont.eot');

变成

@font-face { font-family: 'UniversUltraCondensedRegular'; src: url('http://www.yourdomain.com/fonts/univers-ultracondensed-webfont.eot');

【讨论】:

    【解决方案2】:

    理论上,您提供的 CSS 应该可以工作。很可能,您的问题是由于使用了错误的路径或字体文件的文件权限错误造成的。

    如何解决这个问题:

    首先,如果您使用绝对路径(如zaba 建议的那样),请测试一切是否正常。

    • 如果这确实有效,则表示您的路径不正确。在这种情况下,请确保路径相对于包含 @font-face 语句的 CSS 文件。

    • 如果这不起作用,那么您的问题可能与pathname 无关。在这种情况下,请检查您的字体文件及其所在文件夹的文件权限是否正常。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-12-30
      • 2019-06-02
      • 2013-09-06
      • 2014-05-08
      • 2021-07-21
      • 1970-01-01
      • 1970-01-01
      • 2015-10-02
      相关资源
      最近更新 更多