[英]IE10 browser - X-UA-Compatible“ content=”IE=8 is not working
My application is working fine IE8, When it comes to IE10 it is only working fine in computability view and with IE8 standards. 我的应用程序在IE8上运行良好,当谈到IE10时,它仅在可计算性视图和IE8标准下运行良好。 To force the browser working in same mode I have used below code in my jsp 为了强制浏览器以相同的模式工作,我在jsp中使用了以下代码
<!DOCTYPE HTML>
<html>
--any code
<head>
<meta http-equiv="X-UA-Compatible" content="IE=8">
</head>
--any code
</html>
But IE10 always used IE7 standards. 但是IE10始终使用IE7标准。 Is there any thing wrong in above code? 上面的代码有什么问题吗? Please suggest. 请提出建议。
I made it working through servelet filter which will always ensure working in same mode. 我通过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");
}
Set computability mode through web.xml using below 使用以下内容通过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>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.