簡體   English   中英

IE10瀏覽器-X-UA兼容的“ content =” IE = 8無法正常工作

[英]IE10 browser - X-UA-Compatible“ content=”IE=8 is not working

我的應用程序在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>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM