Forcing IE browsers to behave properly??

You can explicitly tell IE browsers to use its latest available rendering engine using a meta tag. This also prevents IE to open Quirks mode while rending page. You need to add below meta tag at page level to accomplish this.

<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

In above meta tag,

  • IE=edge tells IE to use its latest rendering engine.
  • chrome=1 part tells it to use the Chrome rendering engine if it’s installed on the client computer, which basically brings Chrome rendering power to IE.

Alternatively, same could be done at server level as well.
For Apache web server, you can send the X-UA-Compatible headers by editing your httpd.conf file (shown below):

<Location /mypath>
    Header set X-UA-Compatible "IE=edge,chrome=1"
</Location>

For IIS 7+, you can add custom header setting in your web.config file as shown below:

<system.webServer>
    <!-- ... -->

    <httpProtocol>
       <customHeaders>
           <add name="X-UA-Compatible" value="IE=edge,chrome=1" />
       </customHeaders>
    </httpProtocol>

    <!-- ... -->
</system.webServer>

For IIS 5/6, same can be achieved by adding the custom HTTP Header (as key-value pair) through IIS Manager (inetmgr –> HTTP Headers tab).

Enjoy!!

  • I just want to notice that if you set chrome=1, it is important to also test your page without this setting on IE, as you would want your page to render decent also for those without the Chrome rendering engine installed.