views:

3874

answers:

7

I've set up IIS6 to send the following headers

Custom Header Name: X-UA-Compatible
Custom Header Value: IE=EmulateIE7

that supposed to force IE 8 into IE 7 Compatibility mode. You can read more about it on MSDN .

I have noticed by looking in the Developer toolbar that if I have a DTD defined the document mode correctly gets set to IE 7, but the browser mode is IE 8. If the page doesn't have a DTD the document mode gets set to Quirks and Browser Mode once again IE 8.

Am I doing something wrong. How do I force IE 8 to set IE 7 Browser mode.

Thanks

+4  A: 

I've used this meta tag to force the IE7 mode:

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

Important: you must put this before any other tags in <head>!

(actually you might be able to put a <title> before this, but not putting anything is easier to remember than the specific cases)

Jani Hartikainen
The IIS setting that the OP is using adds this header automatically, so you don't need to include the meta tag in the pages.
Kevin Tighe
Note that you can overwrite the IIS setting with the meta tag as well.
Andrew Song
A: 

I think that's working as designed. I've been using that header value with no problems.

Are you having rendering issues on your pages? You could try using IE=IE7 instead.

Kevin Tighe
+4  A: 

Browser Mode refers to the user-agent header sent by the browser. Since the UA has already been sent before the HTTP response comes back containing your EmulateIE7 directive, it's too late to change the browser mode; only the document mode is changed.

See http://msdn.microsoft.com/en-us/library/dd565628(VS.85).aspx#bdmodes

EricLaw -MSFT-
A: 

I have the same problem... take a look at http://www.wagg-dev.com.resultit.co.uk/default.aspx

In IE7, the images of dogs etc on the 'masthead' at the top have a transparent background. In IE8, they show white backgrounds. IE8 Compatibility View (selected by pressing the button or via Developer Tools "Browser Mode") works fine.

However, I cannot for the life of me get the browser to behave as it does in Compatibility View by means of a meta tag. Developer tools shows "IE7 Standards Mode", which should work (quirks mode doesn't)... but the browser mode stubbornly remains at IE8 and the images display white backgrounds.

What am I missing? I just want to simulate the effect of pushing the compatibility view button by adding a meta tag... which seems like the exact same effect the tag/button combo are intended for, no?

Cheers for your help!

Kev

Kevin
A: 

Check this link

http://ilia.ws/archives/196-IE8-X-UA-Compatible-Rant.html

Need to add a custom header as described in the link. Still looking for a non header solution when using the transitional DTD.

infocyde
additional link http://www.terminally-incoherent.com/blog/2009/07/27/forcing-ie8-compatibility-mode-in-iis/
infocyde
A: 

hi! found this solution... hope it works!

Notice: You will have to put the "header" line before any html is sent to the browser (http://www.php.net/header)

It's PHP code, the line should be like this:

header('X-UA-Compatible: IE=7');

Nicolas