How to serve fonts from different servers for IE users?

家住魔仙堡 提交于 2020-01-11 11:03:35

问题


I have users on IE9 who cannot see my custom fonts. First I thought it was a CORS issue, but after some experimentation I believe it is because the security settings are such that IE will not allow any third-party content under any circumstance (this is on a massive conservative enterprise network of managed computers).

This might also be an issue on newer versions of IE set to "high" security, I'm not sure.

So I think the best solution is to serve fonts directly from my domain for IE users, instead of from the CDN.

  1. does this sound like a good approach?
  2. how can I do this with conditional comments?

回答1:


Here's a way to do it with conditional comments. I don't know how your fonts and other styles are organized, but you'll probably want to use

<!--[if IE 9]>
    stylesheet using internally served fonts
<![endif]-->

and maybe

<!--[if !IE]> -->
    stylesheet using CDN
<!-- <![endif]-->

The latter will apply not only to non-IE browsers but also to IE10 and up, but you might only need to use the former.

To answer your first question, I prefer using fonts from my own servers when in production. Cuts down on the number of moving parts and means that my site doesn't rely on another site.



来源:https://stackoverflow.com/questions/25296480/how-to-serve-fonts-from-different-servers-for-ie-users

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!