Html IE10浏览器-X-UA-Compatible“;内容=”;IE=8不工作

Html IE10浏览器-X-UA-Compatible“;内容=”;IE=8不工作,html,internet-explorer,jsp,browser,internet-explorer-8,Html,Internet Explorer,Jsp,Browser,Internet Explorer 8,我的应用程序在IE8上运行良好,而在IE10上,它只在可计算性视图和IE8标准下运行良好。为了强制浏览器以我在jsp中使用的以下代码相同的模式工作 <!DOCTYPE HTML> <html> --any code <head> <meta http-equiv="X-UA-Compatible" content="IE=8"> </head> --any code </html> --任何代码

我的应用程序在IE8上运行良好,而在IE10上,它只在可计算性视图和IE8标准下运行良好。为了强制浏览器以我在jsp中使用的以下代码相同的模式工作

<!DOCTYPE HTML>
<html>
  --any code
  <head>
    <meta http-equiv="X-UA-Compatible" content="IE=8">
  </head>
  --any code
</html>

--任何代码
--任何代码

但是IE10总是使用IE7标准。上面的代码有什么错误吗?请建议。

我通过servelet过滤器使其工作,该过滤器将始终确保在相同模式下工作

 public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws ServletException, IOException {
    if (compatibilityMode != null) {
        HttpServletResponse res = (HttpServletResponse) resp;
        res.addHeader("X-UA-Compatible", compatibilityMode);
    }
    chain.doFilter(req, resp);
}
public void init(FilterConfig config) throws ServletException {
  String compatibilityMode = config.getInitParameter("compatibilityMode");
}
使用以下命令通过web.xml设置可计算性模式

<filter>
    ....
    <init-param>
        <param-name>compatibilityMode</param-name>
        <param-value>IE=8</param-value>
    </init-param>
</filter>

<filter-mapping>
    <filter-name>filter</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>

....
相容性模型
IE=8
滤波器
/*

您可能有覆盖meta标记的本地浏览器配置设置。您可以尝试通过HTTP头设置
X-UA-Compatible
标志;我听说这样做时,它优先于用户配置,在通过元标记设置时,它可能并不总是这样做。(顺便说一句,你真的想以理智的名义强制IE8模式,whyyyyyy???))谢谢。它在添加到标题后工作。正如您所建议的,某些配置可能会中断此操作。我更倾向于强制使用IE8,因为它在该模式下工作正常,不适合其他标准。