3

I want to avoid that. I've tried:

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

(from HTML5 doctype putting IE9 into quirks mode? ) And:

<meta http-equiv=”X-UA-Compatible” content=”IE=9″ />

(from Disable quirks mode for parent frame )

But neither helps. When I do F12 - Document mode IE9 standards - the page is shown fine.

Any solution?

Community
  • 1
  • 1
ispiro
  • 23,513
  • 30
  • 116
  • 236
  • This sounds like the same issue as in this question: http://stackoverflow.com/questions/13146843/ie-quirks-mode-making-page-render-strange-li-elements-not-horizontal/13147482#13147482 - my answer there might help. – Spudley Nov 06 '12 at 22:15
  • @Spudley Nope. Quirks mode. It says so explicitly when I click F12. But thanks. – ispiro Nov 06 '12 at 22:21

2 Answers2

5

If the page is local, or on an Intranet , Internet Explorer defaults to quirks mode.

If you put the same page on The Web, it would behave as expected.

To get it working as you want, as you are using ASP.NET, you can add this to your web.config file:

<system.webServer>
<httpProtocol>
  <customHeaders>
    <clear />
    <add name="X-UA-Compatible" value="IE=edge" />
  </customHeaders>
</httpProtocol>

This avoids having to override the user settings for all Intranet pages.

Fenton
  • 206,497
  • 63
  • 356
  • 369
  • Thanks. I'm trying now on the web. About your code for the web.config - Isn't that just like what I tried? (I'm not being facetious. I'm asking.) – ispiro Nov 06 '12 at 21:56
  • 1
    your first paragraph is incorrect -- it's not quirks mode but compatibility mode that it defaults to. This config setting for local intranet sites actually overrides the `X-UA-Compatible` flag, so you have to change the setting manually in the browser. Microsoft seem to be very good at knowing how to be annoying when they're trying to be helpful. – Spudley Nov 06 '12 at 22:18
1

I was running the page locally and having this issue. I was using HTML5 and just starting my page with <html>.

When I added <!DOCTYPE html> it magically started working (even locally).

In context:

<!DOCTYPE html>
<html>
<head>
    <title>Example</title>
    <add name="X-UA-Compatible" value="IE=edge" />
</head>

More info about IE8 and doctype.

Justin
  • 22,998
  • 16
  • 104
  • 122