Force IE9 to emulate IE8. Possible?
Asked Answered
P

4

48

Is this possible at all? I tried adding this to the page but it didn't change a thing.

<meta http-equiv="X-UA-Compatible" content="IE=8">

UPDATE- I'm trying to do this because our site has some IE9 specific CSS issues, which wouldn't appear in IE8.

Thanks

Pharmacognosy answered 27/1, 2011 at 0:32 Comment(2)
IE9 is not finished yet - maybe they will release this sort of information upon final release.Rambort
There's a few IE9 specific CSS issues on our site, which don't appear in IE8.Pharmacognosy
A
65

You can use the document compatibility mode to do this, which is what you were trying.. However, thing to note is: It must appear in the Web page's header (the HEAD section) before all other elements, except for the title element and other meta elements Hope that was the issue.. Also, The X-UA-compatible header is not case sensitive Refer: http://msdn.microsoft.com/en-us/library/cc288325%28v=vs.85%29.aspx#SetMode

Edit: in case something happens to kill the msdn link, here is the content:

Specifying Document Compatibility Modes

You can use document modes to control the way Internet Explorer interprets and displays your webpage. To specify a specific document mode for your webpage, use the meta element to include an X-UA-Compatible header in your webpage, as shown in the following example.

<html>
<head>
  <!-- Enable IE9 Standards mode -->
  <meta http-equiv="X-UA-Compatible" content="IE=9" >
  <title>My webpage</title>
</head>
<body>
  <p>Content goes here.</p>
</body>
</html> 

If you view this webpage in Internet Explorer 9, it will be displayed in IE9 mode.

The following example specifies EmulateIE7 mode.

<html>
<head>
  <!-- Mimic Internet Explorer 7 -->
  <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" >
  <title>My webpage</title>
</head>
<body>
  <p>Content goes here.</p>
</body>
</html> 

In this example, the X-UA-Compatible header directs Internet Explorer to mimic the behavior of Internet Explorer 7 when determining how to display the webpage. This means that Internet Explorer will use the directive (or lack thereof) to choose the appropriate document type. Because this page does not contain a directive, the example would be displayed in IE5 (Quirks) mode.

Annice answered 17/2, 2011 at 11:10 Comment(2)
That did the trick, it had to be the first element inside the head tag.Pharmacognosy
The link was just for props really, the actual information is all in the msdn link.Annice
V
26

Yes. Recent versions of IE (IE8 or above) let you adjust that. Here's how:

  • Fire up Internet Explorer.
  • Click the 'Tools' menu, then click 'Developer Tools'. Alternatively, just press F12.

That should open the Developer Tools window. That window has two menu items that are of interest:

  • Browser Mode. This setting determines the value of the user-agent header sent for every request.
  • Document Mode. This setting determines how the rendering engine renders the page.

More at http://blogs.msdn.com/b/ie/archive/2010/06/16/ie-s-compatibility-features-for-site-developers.aspx

Varve answered 27/1, 2011 at 0:43 Comment(1)
I knew about this, but I was trying to make the page render in IE8 mode for all visitors, not just for me when debugging. Thanks thoughPharmacognosy
G
2

The 1st element as in no hard returns. A hard return I guess = an empty node/element in the DOM which becomes the 1st element disabling the doc compatability meta tag.

Gradely answered 12/9, 2011 at 10:7 Comment(0)
L
2

On the client side you can add and remove websites to be displayed in Compatibility View from Compatibility View Settings window of IE:

Tools-> Compatibility View Settings

Lest answered 26/11, 2012 at 10:55 Comment(1)
I know this doesn't exactly fix the problem, but it is a perfect workaround for our corporate environment with 10+ users who are facing this problem.Freddyfredek

© 2022 - 2024 — McMap. All rights reserved.