2011-12-14 44 views
6

我想在Windows Mobile 7.5上定位IE浏览器。谁能告诉我是否有没有办法使用条件注释来定位Windows Mobile 7.5浏览器?

<!--[if lt IE <mobile browser>]> <include retina display> <[end if]--> 

条件注释语法样式适用于定位Windows Mobile?

编辑:由于下面的评论我能找到解决方案。 The <!--[if IEMobile]> <[end if]-->语法适用于Windows Mobile 7,但我无法使它适用于Windows Mobile 7.5。因为我正在构建一个不需要在桌面设备上呈现出色的移动网站,所以我能够使用通用的<!--[if gt IE 7]>评论来解决我在两个呈现之间存在的问题。

如果任何人有一个更优雅的解决方案,因为所需的桌面支持,这将无法正常工作,我很乐意听到它。

+0

你能结合两者吗? `<! - [if IEMobile]><! - [if gt IE 7] - > ... ` – mange 2011-12-15 03:36:35

+0

在我的模拟器7.5测试中甚至不会触发`<! - [if IEMobile ]>`。就有条件的评论而言,它就像IE9一样。 – donut 2012-01-23 21:39:26

回答

1

可能是这对你的工作

<!--[if IEMobile]> 
... 
<![endif]--> 
0
<pre> 
<code> 
is this help for you by checking device width? 
<!-- [if (min-device-width: 481px)]> 

<![endif]—> 
</code> 
</pre> 
2

万一有人遇到这个问题。一些值得了解的点:

IE Mobile 7.5报告字体的误报。因此,你用Modernizr为这个特性付出了代价。

要混淆事项,它也会忽略IE Mobile的条件注释,如上所示。它实际上为IE9提供有条件的评论。我是能够解决的唯一途径是增加一个有条件的评论是这样的:

<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]--> 
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]--> 
<!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]--> 
<!--[if IE 9]> <html class="no-js ie9 ieMobile75" lang="en"> <![endif]--> 
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]--> 

然后前缀相关的风格与.ieMobile75类。如果你想避免这些风格击中桌面IE浏览器,我会建议在媒体查询中结合它们。

相关问题