IE Intranet Compatibility View not including certa

2019-08-30 16:33发布

问题:

I have a site that is using the font Lato with weights 400, 300 & 100 from the Google Fonts API. The site works fine on my local machine but when published to the Intranet, the Lato font disappears and falls back on another font. I realise that this is a problem with Compatibility view as the problem disappears when the box in (IE 11) is unticked where it says 'Display Intranet Sites in Compatibility View'. However I cannot disable compatibility view as certain sites on the Intranet require it and it will cause problems.

Is there anyway to get this font to work correctly; I have tried Google and the various responses that come up say to try and use a meta tag in the html but this hasn't worked for me. Unfortunately, ditching Internet Explorer completely for FireFox, Chrome is not an option either despite the font working in both FireFox & Chrome.

This is how I am importing the font:

<link href='http://fonts.googleapis.com/css?family=Lato:400,100,300' rel='stylesheet' type='text/css'>

Used in CSS:

h1 {
  font-family: "Lato", Arial, sans-serif;
  font-weight: 100 !important;
}

Any help would be greatly appreciated, Thanks

回答1:

Looks like the IE bug for the src attribute parsers rears its ugly head when in compatibility mode. More information and a fix can be found in this answer.



回答2:

The fact that you are using compatibility mode tells me you are trying to make IE use IE 9 or below, which don't support web fonts, well 9 does, but not 8 or 7. If the site works in Chrome and FireFox, then just render the site in edge or the latest version of IE and enjoy the modern goodness.