如何为不同的服务器为IE用户提供字体? [英] How to serve fonts from different servers for IE users?
问题描述
我有IE9的用户无法看到我的自定义字体。首先我认为这是一个CORS问题,但在一些实验后,我相信这是因为安全设置是这样的IE将不允许任何情况下的任何第三方内容(这是一个庞大的保守的企业网络的托管计算机)。
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).
这可能也是较新版本的IE设置为高安全的问题,我不确定。
This might also be an issue on newer versions of IE set to "high" security, I'm not sure.
所以我认为最好的解决方案是直接从我的域为IE用户而不是从CDN服务字体。
So I think the best solution is to serve fonts directly from my domain for IE users, instead of from the CDN.
- 这是否是一个好方法?
- 我如何用条件注释做这个?
推荐答案
这里有一个方法来做条件注释。我不知道你的字体和其他样式是如何组织的,但你可能想使用
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]-->
也许
<!--[if !IE]> -->
stylesheet using CDN
<!-- <![endif]-->
后者不仅适用于非IE浏览器,还适用于IE10及以上版本,只需要使用前者。
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.
这篇关于如何为不同的服务器为IE用户提供字体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!