Configure Tomcat to send web pages compatible to IE 7 or 6

Spiderman picture Spiderman · May 11, 2010 · Viewed 13k times · Source

I have got an application that is not compatible to work using IE8 browser.

I am looking for a way to to configure Tomcat on which this application run, so the pages could be read by IE8 and treated as if they are IE7 or IE6

By googling so far I found a possible suggestion which say to add to the http response the header: X-UA-Compatible: IE=EmulateIE7
here

that tell IE8 to be like IE7.

The problem is that this way requires adding a filter that should be added on application level. I'd like to know if any of you is familiar with a more generic way that Tomcat enables to send its http content to be IE7 (or IE6) compatible ?

Answer

Jonny Alexander picture Jonny Alexander · Nov 11, 2014
  1. Download urlrewritefilter-4.0.3.jar from http://tuckey.org/urlrewrite/
  2. Add urlrewritefilter-4.0.3.jar to WEB-INF/lib
  3. Add following code to WEB-INF/web.xml
<filter>
<filter-name>UrlRewriteFilter</filter-name>
<filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>UrlRewriteFilter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>
  1. Make a new configuration file for the module. (WEB-INF/urlrewrite.xml)
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE urlrewrite PUBLIC "-//tuckey.org//DTD UrlRewrite 4.0//EN" "http://www.tuckey.org/res/dtds/urlrewrite4.0.dtd">
<urlrewrite>
<rule><condition name="user-agent">.*MSIE.*</condition>
<set type="response-header" name="X-UA-Compatible">IE=EmulateIE7</set>
</rule>
</urlrewrite>