How to prevent IE from opening my page in compatibility mode?

回眸只為那壹抹淺笑 提交于 2020-03-06 08:06:05

问题


I have this html/jsp page:

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML>
<html ...
</html>

which, for some reason, is opened by default in compatibility mode on IE (in my case version 10) and this messes up everything as it just does not understand some modern constructs present in libraries such as angularjs. By opening developer's tools and changing the view mode to "standard IE" everything fixes up and my web application works fine.

So, what's wrong with this header? Is there a way to force IE to open my page in normal mode?

This question is more or less the same of this one, I know that: Why Does IE-8 push the view to Compact/Compatibility view?

but I don't want to force my user to open tools and set options like correct marked answer suggests: most of them are just ignorant, many of them have developers tools disabled on their company's PC. In the end just want to see where's the problem with my web application and make so that IE accepts it as a normal page.


回答1:


insert meta tag in header HTML:

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

The "edge" forces standards mode (or latest rendering engine) in IE.

To force IE8 to standard mode.

<meta http-equiv="x-ua-compatible" content="IE=8">


来源:https://stackoverflow.com/questions/32648564/how-to-prevent-ie-from-opening-my-page-in-compatibility-mode

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