Override ‘Display Intranet sites in Compatibility View’

I recently faced this issue, where the page was not rendering properly in the company’s lan in Internet Explorer 8 (IE 8) (thanks to some advanced jQuery plugins incorporated). After sacrificing 1.5 hours of my life on this problem, I figured out the solution. The problem is, by default, the checkbox (present in menu->tools) ‘View Intranet sites in compatibility view’ is checked, which tells IE-8 (or later) to render the page assuming page is built acc to IE-7 standards.

The Solution:-
If you are using IIS as your server, then adding the following meta tag to your pages might solve your problem: –

See this link for details – Solution if using IIS

But in my case I was using apache-tomcat, the solution for which is adding header to response from backend. The same can be achieved by using a filter/request interceptor through which every request will pass which is generally used to verify whether the user is still logged in or not. This is the place where we can modify the header to the response.

I presume, one knows how to add a request interceptor in a Java based web application. If you don’t have much idea on how to do this then I would encourage you to visit this link –

How to add RequestInterceptor to a Spring based application

Similarly, you can easily find links to add a filter in a Struts or any other framework based application.

Now we just need to add a single line to the class representing our filter/request interceptor. Please see below code snippet:-

//before the actual handler will be executed
public boolean preHandle(HttpServletRequest request,
HttpServletResponse response, Object handler)
throws Exception {

// Some logic

// below statement ensures IE trusts the page formatting and will render it acc. to IE 8 standard.
response.addHeader("X-UA-Compatible", "IE=8"); 

return true;

I have myself verified above solution works for IE-8.

Hope this small fix saves someone’s time.


2 thoughts on “Override ‘Display Intranet sites in Compatibility View’

    • Hi Javee, haven’t checked the same for IE9, but in IE8 this solution definitely works.If you find any solution for IE9, then you can post the link here also! Thanks a lot for reading anyways!! 🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s