Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Conditional Comments to target Windows Phone 7 Internet Explorer 9

Problem

Conditional comments, such as

<!--[if IEMobile]>
    <p>Welcome to Internet Explorer Mobile.</p>
<![endif]-->
<![if !IEMobile]>
    <p>All other browsers</p>
<![endif]>

don't work on Windows Phone 7! Or, at least not on mine.


Question

Does anyone know exactly how to use these comments, and had tested them before? Does IE 9 on WP7 even support this?

like image 670
neeKo Avatar asked Nov 04 '22 07:11

neeKo


2 Answers

Try using gte (in case it's seeing your phone as 7.5)

<!--[if gte IEMobile 7]>
<p>Welcome to Internet Explorer Mobile.</p>
<![endif]-->
<![if !IEMobile 7]>
<p>All other browsers</p>
<![endif]>
like image 148
Herb Meehan Avatar answered Nov 16 '22 09:11

Herb Meehan


Im sorry to say but the following used to work before Mango.

<!--[if IEMobile 7]>
    <p>Welcome to Internet Explorer Mobile.</p>
<![endif]-->
<![if !IEMobile 7]>
    <p>All other browsers</p>
<![endif]>

It looks like now you would have to use JAvaScript and check the UserAgent to see if Windows Phone OS 7 or Windows Phone OS 7.5 is listed...Only way

like image 40
MyKuLLSKI Avatar answered Nov 16 '22 08:11

MyKuLLSKI