and it works " /> and it works " /> and it works "/>

How to conditionally apply x-ua meta tag only to ie10 and below?

120 Views Asked by At

I have a situation where the following x-ua code is added to the header

<meta http-equiv="X-UA-Compatible" content="IE=9; IE=8; IE=7" />

and it works well in IE versions 10 and below. But it makes some functionalities not working in IE11.

Functionalities will work fine in IE11 if the meta tag is removed, but now i'm not in a position to remove the meta tag completely as my application has to support IE9+ versions and the removal will make functionalities not to work in IE10

1

There are 1 best solutions below

0
Vikas Jadhav On

Try this:

<!--[if IE 9]>
    <meta http-equiv="X-UA-Compatible" content="IE=8" />
<![endif]-->
<!--[if gt IE 9]>
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
<![endif]-->

Note: IE10 doesn't support conditional comments https://learn.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/compatibility/hh801214(v=vs.85)