How to push your clients to render your website in a specific version of Internet Explorer

You might have a website which was developed many years ago while current Internet Explorer versions were not on the market. Let’s say it works on IE 9. However, when you browse it on IE 11, it has some compatibility issues such as undefined CSS or jQuery classes. In this case, you should tell client IE to render this page with IE 9 engine. But how?

Answer is X-UA-Compatible tag.

You can add this tag by specifying the IE version you want to be used. There are 3 ways to add it into your project:

  1. Add a meta tag into your ASPX page
    <meta http-equiv="X-UA-Compatible" content="IE=edge">

    Put this line right after <head> tag. It’s not recommended to place it under other meta tags because your page will be refreshed when IE engine sees this tag.

  2. Add it into your web.config
                        <add name="X-UA-Compatible" value="IE=9" />
  3. Add it into your Response object in code-behind (CS file)
    HttpContext.Response.AddHeader("X-UA-Compatible", "IE=9");

Note: If you want your page to be rendered with the latest IE engine available on client side, use IE=egde value instead of IE=9.