Conditional Comments to target Windows Phone 7 Internet Explorer 9

随声附和 提交于 2019-12-10 14:51:59

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!