How to ban the compatibility mode on IE?

How to ban the compatibility mode on IE

Sometimes happens that a customer calls saying ' my site's broken ' or you indicating that a feature that you have tested on reasonably recent browsers does not work. After a quick diagnosis, you notice that said client uses Internet Explorer, but with no tangible reason, compatibility mode enabled (small page broken in the address bar).
At the base, compatibility mode is expected to be able to run old sites that were designed to fashion thetag soup and presentation tables. They didn't care about good adherence to standards (sad era of the "optimized for IE »).
Ideally, the possibility of using this mode should be left, however, it is sometimes painful to look for an hour which may not work in a user while the site has been designed in the State of the art (understand within the) standards, tested on reasonably recent versions of Internet Explorer).
However, it is possible to forbid this possibility, and in several ways:
  • via a meta-tag: <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  • via a header PHP: header('x-ua-compatible: ie=edge');
  • or either directly in a .htaccess file via: header set X-UA-Compatible "IE=Edge"
If you are using the latest version, and without restricted this header to the files only, it may be useful to disable it for file types not having need:
<FilesMatch ".(js|css|gif|png|jpe?g|pdf|xml|oga|ogg|m4a|ogv|mp4|m4v|webm|svg|svgz|eot|ttf|otf|woff|ico)$">
Header unset X-UA-Compatible
</FilesMatch>
As it is difficult to have a comprehensive list of all types of files, so prefer to apply this header files in need (php, html, etc.). Using one of these three methods, you'll see that IE no longer offers this compatibility mode on your site, it will be forced to use the highest rendering.
In addition, if you use the meta tag, it does not pass to the validator HTML5, it will therefore in this case surround with conditional comments:
<!--[if IE]>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<![endif]-->
Or:
<!--[if IE]>
<meta http-equiv="X-UA-Compatible" content="IE=10">
<![endif]-->
Attention : ban compatibility mode does not dispense for as many test rendering on various versions of Internet Explorer!

No comments

Powered by Blogger.