views:

235

answers:

4

I have been stuck on this one for a while - I couldn't figure out why a website renders differently in two identical versions of Internet Explorer. Half an hour ago I came across a compatibility mode button in IE which made me really angry.

Disabling compatibility mode has fixed my problem.

Is there a way to disable it programmatically, i.e. from a web page?

Edit:

Just came across this blog http://blogs.msdn.com/b/askie/archive/2009/03/23/understanding-compatibility-modes-in-internet-explorer-8.aspx

I'll post an example code after reading the article

A: 

You probably need to set your DOCTYPE correctly. Check out MSDN's articles on DOCTYPE and Defining Document Compatibility for more info.

Donut
A: 

Not sure if you can do that through a web page, may be better to code for IE compatibility mode (IE 7). :(

Spooks
A: 

html doctype can help you

Vinay B R
+6  A: 

If you want the "old" rendering, and no button to show up on the toolbar so that users can switch modes you can use this:

<head>
  <!-- Mimic Internet Explorer 7 -->
  <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" >
  <title>My Web Page</title>
</head>

other options (old and new) include:IE=5, IE=7, IE=8, or IE=edge

(edge equals highest mode available)

scunliffe
Thank you - this works. This still means that I have to change my code to work in IE 7..
vikp
Is there something in particular you have that won't work in IE8 Standards mode? If so, post another question and maybe we can solve it for you.
scunliffe
It's a positioning of divs. I have read somewhere that IE7 needs extra few pixels for left and right margins or something on those lines. THe site looks great in firefox, safari, chrome, even ie 8 without compatibility mode...but IE 7 is a different story
vikp
Hey, vikp. I've never had problems between IE7 and IE8 as long as the DOCTYPE was specified and its (the DOCTYPE's) standards were met.
Francisc