How can I programmatically disable IE compatibility mode?

别说谁变了你拦得住时间么 提交于 2019-12-02 14:02:41

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)

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

Please also note that also IE8 browser settings can enforce a certain mode. I have a customer who has IE8 compatibility mode enforced by policy in intranet mode.

Please add to force IE not apply Compatibility Mode

<meta http-equiv=Content-Type content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8">

In my case, I fixed it by adding the following tag after the <head> tag:

<meta content="IE=edge" http-equiv="X-UA-Compatible">
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!