Solution for this problem is not sanding XHTML
from server but native HTML
. This providing filter which change response from application/xhtml+xml
to text/html
. Filter get response form header of user agent and find if is set „compatible; msie 8.0“
which means, that IE11
runs under Enterprise Mode and Emulate IE8
.
Our implemented solution:
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);
}
}
}