简体   繁体   中英

How to create site which in IE=11 uses edge mode and in others IE use IE=6

This is really hard question. I need to open page in IE11 with edge mode and in others IE (11,10,9,8) i need to run page with IE6 mode. I tried to use

<meta http-equiv="X-UA-Compatible" content="IE=edge,IE=6" />

tried to use

<!--[IF LT IE 10]>
<meta http-equiv="X-UA-Compatible" content="IE=6" />
<![ENDIF]-->

even tried to change meta attribute with javascript and nothing works.

pls help

I would strongly advise not forcing IE10 through IE8 to behave as though they are a seriously non-standards-compliant browser from 2001.

But if you really have a case for needing to do that, I expect the venerable (and otherwise-to-be-avoided) document.write could do it for you:

<head>
<script>
if (thisIsIE()) {
    document.write(
        '<meta http-equiv="X-UA-Compatible" content="IE=' +
        thisIsIE11() ? "edge" : "6" +
        '">'
    );
}
</script>

Of course, you can't do that in XHTML.

Alternately, detect server-side and vary what you send back.

And again, really, if you can possibly avoid doing this (and you almost certainly can)...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM