Fixing IE Compatibility View Errors 2015/11/05
I mostly hate Internet Explorer. Well, hate is a strong word, but I strongly dislike it. Sometimes it just makes the life of a web developer much more difficult.
One of the issues I've had lately concerns Compatibility view. Consider yourself lucky if you've never heard of it. In the old days (<IE9) Internet Explorer was notoriously bad in supporting web standards. Due to its market share in the corporate world a lot of company sites and intranets were designed specifically for IE.
Microsoft has cleaned up its act and things are much brighter since IE10. Except for those using the old web sites designed for older IE versions. This is where compatibility view comes in. It makes the new browsers render web pages as if they are old browsers. If you only develop modern, standards compliant web sites, you can call this brake the whole site feature. And it's built right in the browser and available in the address bar.
Yes, it's right there in the address bar and it's pretty easy to accidentally click it.
I run into this issues every now and then. At work we still need to support IE8, although it's rarely used these days. IE9 is still quite common among some of our corporate clients.
The biggest problem is, that some companies have applied company wide policies to enforce Compatibility mode on all sites. And, of course, the end users are not allowed to change the settings themselves.
How to Fix This?
Here's how to solve this problem. Just add this meta tag to the head of the page.
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
It's kind of an ugly hack to an ugly hack that fixes a problem that should never have existed. But I think it's the easiest way to solve this problem. And the good thing is, that with this tag in place the Compatibility mode switch is completely hidden from the browser address bar.