简体   繁体   English

如何创建在IE = 11中使用边缘模式而在其他IE中使用IE = 6的站点

[英]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. 我需要在具有边缘模式的IE11中打开页面,而在其他IE(11,10,9,8)中,我需要以IE6模式运行页面。 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. 甚至试图用javascript更改元属性,但没有任何效果。

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. 我强烈建议不要强迫IE10到IE8使其表现为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: 但是,如果您确实有需要这样做的理由,我希望古老的(并且可以避免的) document.write可以为您做到这一点:

<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. 当然,您不能在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)... 再说一遍,实际上,如果您可以避免这样做(并且几乎可以肯定的话)...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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