问题
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?
回答1:
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]>
回答2:
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
来源:https://stackoverflow.com/questions/8865130/conditional-comments-to-target-windows-phone-7-internet-explorer-9