Posted in Web Development by Josh Winn with 5 Comments
If you are using the X-UA-Compatible meta tag, then you’ll probably run into this error when attempting HTML5 validation at the W3C. It’s common to use X-UA-Compatible to set Internet Explorer to edge mode (forcing the latest rendering engine), and to enable Google Chrome Frame for visitors with that IE plugin.
To make the validation error go away (perhaps it is your only remaining error?), the meta tag can be removed and the value can be sent through the HTTP headers instead. Depending on the web technology you’re using and your server settings, this can be done in different ways, and I thought it’d be a good idea to collect the syntax in one place.
Set HTTP Header with PHP
If you are working with a PHP framework or template, you can set these with the header function. Since I was already setting a PHP header for Content-Type, as suggested by Google PageSpeed Tools, this was simple for me to add another one:
Using the .htaccess File
Make sure you have the mod_headers module enabled in Apache.
Header set X-UA-Compatible "IE=Edge,chrome=1"
With IIS web.config
Syntax provided by GCF Developer Guide.
<configuration> <system.webServer> <httpProtocol> <customHeaders> <add name="X-UA-Compatible" value="IE=Edge,chrome=1" /> </customHeaders> </httpProtocol> </system.webServer> </configuration>
I don’t typically use C#, but this was mentioned by a StackOverflow user and worth including:
If you would like to check that these are working properly, I would recommend testing the page with a header check tool such as this one.