Html – How to programmatically disable IE compatibility mode

htmlinternet-explorer-7internet-explorer-8xhtml

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 https://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

Best Answer

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)