Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IE page being forced into IE7 Document Mode

I've been investigating a problem and am struggling for new ideas, so I thought I'd see if anyone can help.

I have a page that displays fine in Chrome and Firefox. It also displays fine in IE9, but some of our customers HAVE to use compatibility mode... and when the page is viewed in compatibility mode it forces, for some reason, it to display in IE7 Document Mode.

The page has !DOCTYPE HTML as the first line, and also :

meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1

Which, I believe should force the page to be displayed in the most recent document mode.

When I browse the HTML within F12 Developer Tools, the first line of the html has been commented out:

!-- DOCTYPE HTML --

Can anyone suggest anything I can try to resolve this issue, ie force the page to display in IE9 Document Mode? When I manually alter the Document Mode to IE9 within Developer Tools the page displays fine - so I just need to find out why IE is forcing IE7 Document Mode and not using the default.

Any help very much appreciated.

like image 224
Chris Marks Avatar asked Jun 13 '12 09:06

Chris Marks


1 Answers

You can see my answer to a similar question: X-UA-Compatible is set to IE=edge, but it still doesn't stop Compatibility Mode.

The meta tag doesn't override the document type if the user has certain options toggled in the Compatibility View settings dialog such as "Display intranet sites in compatibility view" or "Display all sites in compatibility view", which sounds like may be the case for some of your customers, whether it's their intention or their company's policies.

To force it out of compatibility view you have to set X-UA-Compatible on the hosting server instead of in the file that's served; for .NET you'll typically set it either in the web.config (IIS7) like my example below or add it to the Custom Http Headers of the web application properties (IIS6).

<system.webServer>
  <httpProtocol>
    <customHeaders>
      <clear />
      <add name="X-UA-Compatible" value="IE=EmulateIE8" />
    </customHeaders>
  </httpProtocol>
</system.webServer>
like image 96
Tim Franklin Avatar answered Sep 30 '22 18:09

Tim Franklin