One of the great things about Internet Explorer 8 is that it finally renders, by default, in a standards mode, using web standards instead of Microsoft’s IE tweaks. It’s also one of the worst things about IE8, for web developers at least. Developers who have spent countless hours to ensure that their web site renders correctly in all browsers may find that it now renders poorly in IE8.
Fortunately, Microsoft anticipated this and built in a compatibility mode, which allows IE8 to render as if it were IE7 instead. If a site worked properly in IE7, it will work properly in IE8 running in compatibility mode. As long as the end user knows enough to change modes of course. End users often don’t realize what version of a web browser they are using. And they even more often won’t know how to, or even that you can, change the browser rendering mode. So it’s up to the developer to ensure they don’t have to.
There are programmatic solutions, meta tags on web pages, code in the web.config and so on, but sometimes it’s just easier to set the entire web site to force IE8 browsers to use IE7 compatibility mode. You can easily do this with a custom header in IIS.
- In IIS7, open IIS Manager, expand the Sites and highlight the site you want to add the custom header to.
- In the IIS section of the Web Site Pane, double-click HTTP Response Headers.
- When the HTTP Response Headers section opens, click on Add in the Action Pane.
- Enter X-UA-Compatible in the Name field.
- Enter IE=EmulateIE7 in the Value field.
- Click OK to finish, no reboot or IIS restart needed.
- In IIS 6, open IIS Manager and right-click the site you want to add the custom header to.
- Choose Properties, then the HTTP Headers tab.
- In the Custom HTTP Headers section, click the Add button.
- Enter X-UA-Compatible in the Custom header name field.
- Enter IE=EmulateIE7 in the Custom header value field.
- Click OK until you have exited the Properties dialog, no reboot or IIS restart is needed.
Just remember to remove this custom header from the site when it is finally IE8 compatible.
As usual, do this at your own risk. If it doesn’t work, too bad. You’re on your own to fix it. If you have changes or suggestions on this, we’d love to see a comment. You can also find this documented online at http://msdn.microsoft.com/en-us/library/cc817572.aspx, where you’ll also find code to do this in your web.config file. Thanks to Joe Healy from Microsoft for pointing out the XUA tag at a very opportune time.