In HTML5, some meta elements do not validate (yet?) like:
<meta http-equiv="x-ua-compatible" content="ie=emulateie7;chrome=1">
<meta http-equiv="imagetoolbar" content="no">
Are Conditional Comments an appropriate solution here resp. will meta elements still work as expected?
<!--[if IE]><meta http-equiv="x-ua-compatible" content="ie=emulateie7;chrome=1"><![endif]-->
<!--[if lt IE 7]><meta http-equiv="imagetoolbar" content="no"><![endif]-->
Using a .htaccess file instead of meta elements (not always possible unfortunately), would this be the right way to go?
<IfModule mod_setenvif.c>
<IfModule mod_headers.c>
# BrowserMatch MSIE ie OR?
BrowserMatch MSIE emulate_ie7
# Header set X-UA-Compatible "IE=EmulateIE7" env=ie OR?
Header set X-UA-Compatible "IE=EmulateIE7" env=emulate_ie7
BrowserMatch chromeframe gcf
Header append X-UA-Compatible "chrome=1" env=gcf
</IfModule>
</IfModule>
Thanks!
Personally for the "x-ua-compatible" tag, i went for the .htaccess directive. I followed the html5boilerplate template:
# ----------------------------------------------------------------------
# Better website experience for IE users
# ----------------------------------------------------------------------
# Force the latest IE version, in various cases when it may fall back to IE7 mode
# github.com/rails/rails/commit/123eb25#commitcomment-118920
# Use ChromeFrame if it's installed for a better experience for the poor IE folk
<IfModule mod_setenvif.c>
<IfModule mod_headers.c>
BrowserMatch MSIE ie
Header set X-UA-Compatible "IE=Edge,chrome=1" env=ie
</IfModule>
</IfModule>
<IfModule mod_headers.c>
# Because X-UA-Compatible isn't sent to non-IE (to save header bytes),
# We need to inform proxies that content changes based on UA
Header append Vary User-Agent
# Cache control is set only if mod_headers is enabled, so that's unncessary to declare
</IfModule>
You can register additional pragma directives:
Extensions to the predefined set of pragma directives may, under certain conditions, be registered in the WHATWG Wiki PragmaExtensions page.
Conformance checkers are then required to recognise them:
Conformance checkers must use the information given on the WHATWG Wiki PragmaExtensions page to establish if a value is allowed or not: values defined in this specification or listed on the aforementioned page must be accepted, whereas values not listed in either this specification or on the aforementioned page must be rejected as invalid.
That may be hard work though, don't know if there's any reason why these headers haven't been listed before but I guess you'll find out if you try it :)
Your .htaccess looks OK according to the MS docs, there may be some variations depending on what version of Apache you're on, but probably the best way to check is to try it and see.