I’ve always been a junkie when it comes to markup validation. It’s important to me that my sites are 100% XHTML/strict compatible. But recently I came across a situation that I thought I simply couldn’t get around. In this article I am going to show you how you can add the X-UA-Compatible attribute and at the same time validate your pages through W3C validation. My website had the following tag:
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
This is a way to force IE to not display the compatibility mode button in the URL. Which I don’t want anyway. While the X-UA-Compatible is a standard meta key, the value IE=edge is not, and therefore the validator gave me an error. So I finally figured it out, I removed the tag from my template and added the meta tag to the standard HTTP header via web.config:
<system.webServer> <httpProtocol> <customHeaders> <add name="X-UA-Compatible" value="IE=edge,chrome=1" /> </customHeaders> </httpProtocol> </system.webServer>
Now both W3C and IE are happy.