1

有什么方法可以在不使用 JavaScript的情况下使用 HTML 条件语句检测 IE Mobile 浏览器?

[if IE]>检查不适用于移动 IE

<!--[if IE]>
    <div class="iemobile-support" >
        ATTENTION: We have detected that you are using Internet Explorer on your device.
    </div>
<![endif]-->
4

1 回答 1

1

仅在 IE 5-9 中支持条件注释。

资源

另一个修复是您可以编写 IE 条件 css 来隐藏或显示 div。

CSS:

    <style>
        .iemobile-support{ display:none; }

        @media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) { 
             /* IE10+ specific styles go here */  
           .iemobile-support{ display:block; } 
        }
    </style>

    <!--[if IE]>
        <style>
            .iemobile-support{ display:block; }
        </style>
    <![endif]-->

HTML:

    <div class="iemobile-support" >
        ATTENTION: We have detected that you are using Internet Explorer on your device.
    </div>
于 2014-08-28T07:30:41.157 回答