• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Lack of interest Remove the X-UA-Compatible meta tag and use a server header, or htaccess instead

Rob

Well-known member
#1
Ok, this isnt the biggest optimisation in the world but it avoids serving that IE only compatability tag to all users.

It can be dropped from the styles, and instead a simple bit of PHP can sent it as a server header:-

PHP:
if (isset($_SERVER['HTTP_USER_AGENT']) &&
   (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false))
       header('X-UA-Compatible: IE=edge,chrome=1');
Or you could add it to the .htaccess file:-
Code:
<FilesMatch "\.(htm|html|php)$">
   <IfModule mod_headers.c>
        BrowserMatch MSIE ie
       Header set X-UA-Compatible "IE=Edge,chrome=1" env=ie
   </IfModule>
</FilesMatch>
This will save some bytes for anyone not using IE, but also bring us a step closer to w3c validation.