本文介绍了配置Tomcat以发送与IE 7或6兼容的网页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个与使用IE8浏览器不兼容的应用程序。

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

我正在寻找一种方法来配置运行此应用程序的Tomcat,所以这些页面可以被IE8读取并被视为IE7或IE6

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

通过谷歌搜索到目前为止我发现了一个可能的建议,说要添加到http响应标题:
X-UA兼容:IE = EmulateIE7

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

告诉IE8就像IE7一样。

that tell IE8 to be like IE7.

问题是这种方式需要添加应在应用程序级别添加的过滤器。我想知道你们中是否有人熟悉Tomcat能够将其http内容发送到IE7(或IE6)兼容的更通用的方法吗?

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 ?

推荐答案

Tomcat是一个通用的Web服务器和servlet容器。因此,它绝对与浏览器无关,因此无法以某种特殊方式配置它来处理IE。

Tomcat is a general purpose webserver and servlet container. It is absolutely browser-agnostic thus, there's no way to configure it in some special way to deal with IEs.

您不必真正添加过滤器。最低限度是在service方法(或doGet或doPost,无论应用程序使用什么)中的任何位置设置响应头:

You don't have to add filter really. The bare minimum is to set the response header anywhere in "service" method (or doGet or doPost, whatever application uses):

res.addHeader(X-UA-兼容,IE = EmulateIE7);

res.addHeader("X-UA-Compatible", "IE=EmulateIE7 ");

但是,如果服务器应用程序中有单个入口点,则会出现这种情况。否则过滤器应该以更好的方式完成工作。

But this is in case when there's a single entry point in the server application. Otherwise filter should do the job in a better way.

这篇关于配置Tomcat以发送与IE 7或6兼容的网页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-03 13:04