【问题标题】:JSF application using IE11 with Enterprise Mode使用带有企业模式的 IE11 的 JSF 应用程序
【发布时间】:2015-02-10 05:39:24
【问题描述】:

我们的应用程序无法使用IE11EM 运行。我们正在使用修改 JSF-1.2RichFaces 3.X 。当我们在 IE11 上运行网页时,没有 EM 一切正常,但我们必须使用 IE11EM。是否有任何可能的方法来从代码中为页面禁用 EM

IE 控制台引发错误:“XML5632:只允许一个根元素。”在页面之间移动时发生。

PS:应用程序在 IE8IE9IE11 上运行没有任何问题,但是当您尝试使用 IE11EM 时,它会引发错误。

【问题讨论】:

  • 升级 JSFRichFaces合理吗?还是使用不同的技术重新编程应用程序?
  • 企业模式定义:页面当前在企业模式下呈现,这是一个模拟 Windows Internet Explorer 8。并且 IE8 不支持带有 元素的 iframe。 (technet.microsoft.com/library/dn640687.aspx) 现在构建应用程序在 IE8 引擎上运行毫无意义。
  • 尝试从 Servlet 过滤器中添加 http 标头“X-UA-Compatible: IE=Edge”。例如:response.addHeader("X-UA-Compatible", "IE=Edge");
  • 问题在于解析 xhtml..

标签: internet-explorer richfaces internet-explorer-11 jsf-1.2 netweaver


【解决方案1】:

如果您的应用程序仅限于 Intranet 并且可以在受限网络中访问,那么您可以通过网络的组策略禁用 EM

http://msdn.microsoft.com/en-us/library/dn640688.aspx

或者,您可以尝试从 SiteList 文件(上面链接中提到的注册表 EM 条目指向的文件)中删除您的应用程序的 URL,这样您的应用程序就不会包含在 EM 站点列表中

其他参考: http://msdn.microsoft.com/en-us/library/dn640699.aspx

【讨论】:

  • 这不是我的解决方案。我们的客户对此有公司政策,并且应用程序在 Frame 中运行,而其他应用程序必须在 EM 上运行。我要求从代码中为页面禁用 EM..
【解决方案2】:

此问题的解决方案不是从服务器打磨XHTML,而是从本地打磨HTML。这个提供过滤器将响应从application/xhtml+xml 更改为text/html。过滤获取用户代理的响应表单标题并查找是否设置了„compatible; msie 8.0“,这意味着IE11 在企业模式下运行并模拟IE8

我们实施的解决方案:

public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {

   String userAgent = ((HttpServletRequest) request).getHeader("user-agent");

   if (userAgent != null && userAgent.toLowerCase().contains("compatible; msie 8.0"))
    {   
     chain.doFilter(request, new ForcableContentTypeWrapper((HttpServletResponse) response));
    }
    else 
    {
     chain.doFilter(request, response);
    }
}

private class ForcableContentTypeWrapper extends HttpServletResponseWrapper
{
     public ForcableContentTypeWrapper(HttpServletResponse response)
    {
    super(response);
    }

    @Override
    public void setContentType(String type)
    {
      if (type.contains("application/xhtml+xml")) 
    {
        super.setContentType(type.replace("application/xhtml+xml", 
                                          "text/html"));
    }
    else 
    {
      super.setContentType(type);
    }

     }
 }

【讨论】:

    猜你喜欢
    • 2012-04-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-05-06
    • 1970-01-01
    相关资源
    最近更新 更多