views:

843

answers:

2

Hi,

Just updated my site to newer, much more standards compliant design. My previous design was so rubbish that I had to use the IE=EmulateIE tag to force IE7 emulation.

Unfortunately, I believe that browsers may be caching this setting from previous visits, causing my new site (which looks great without the button pressed) to look rubbish again...

Is there any opposite tag that I could use, or some magic I can make PHP do to the HTTP headers disable caching of this setting?

Many thanks

Jack

+3  A: 

In the absence of an X-UA-Compatible http-equiv header, the compatibility mode is determined by the !DOCTYPE (or the absence of a !DOCTYPE, as the case may be). For a chart of which !DOCTYPE gives you which mode (in various browsers) see here:

http://hsivonen.iki.fi/doctype/ (You'll need to scroll down toward the bottom of the page.)

You can override this behavior by using a meta element to specify an X-UA-Compatible http-equiv header, like so: <meta http-equiv="X-UA-Compatible" content="IE=edge" >

(Note: IE=edge goes with the highest available version -- currently IE8 as of this posting -- or one can explicitly specify IE8.)

For more information, see here: http://msdn.microsoft.com/en-us/library/cc288325(VS.85).aspx

Tim Goodman
Rather than using an aribirarity large number for the IE version, it would be better to use the supported keyword 'edge' to alway force the latest version.<meta http-equiv="X-UA-Compatible" content="IE=edge" >
mbenny
@mbenny: Good point. I have updated the answer to reflect this.
Tim Goodman
It's noteworthy that the META tag must come before any SCRIPT tags in the HEAD section.
xero
+1  A: 

IE will never cache the X-UA-Compatibility setting on its own. The only other possibility is that users of the site pressed the 'Compatibility View' button on the address bar before you had the X-UA-Compatbile meta tag set. Then your site's domain will appear in a list stored locally on the client's machine. I wrote a blog post about how site owners can prune their domains from that locally stored list if/when a site gets updated to be IE8 compatible. http://blogs.msdn.com/ie/archive/2009/07/01/ie-compatibility-list-pruning.aspx

mbenny