htmlinternet-explorermobile-websiteie-mobile

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]-->

Solution

  • 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>