Mithun Sreedharan
Mithun Sreedharan

Reputation: 51272

How to detect the IE Mobile browser using HTML conditional statements WITHOUT using JavaScript?

Is there any way to detect the IE Mobile browser using HTML conditional statements WITHOUT using JavaScript?

[if IE]> check is not working for mobile IE

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

Upvotes: 1

Views: 820

Answers (1)

karan3112
karan3112

Reputation: 1867

Conditional comments are only supported in IE 5-9.

Source

Another fix is that you can write IE conditional css to hide or show the 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>

Upvotes: 1

Related Questions