Is there a way to target Windows Mobile 7.5 browse

2019-04-07 22:06发布

问题:

I'm trying to target the IE browser on Windows Mobile 7.5. Can anyone tell me if the

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

conditional comment syntax style works for targeting Windows Mobile?

EDIT: Thanks to the comment below I was able to find a solution. The <!--[if IEMobile]> <[end if]--> syntax works for Windows mobile 7, but I couldn't get it to work for Windows mobile 7.5. Because I am building a mobile website that isn't required to present well on desktop devices I was able to use a generic <!--[if gt IE 7]> comment that gets around the issue I was having between the two renderings.

If anyone out there has a more elegant solution for when this won't work because of required desktop support, I'd love to hear it.

回答1:

may be this work for you

<!--[if IEMobile]>
...
<![endif]-->


回答2:

Just in case anyone experiences this issue. Some points worth knowing:

IE Mobile 7.5 reports false positive for font-face. Therefore, you're out of luck forking that feature with Modernizr.

To confuse matters, it also ignores conditional comments for IE Mobile as suggested above. It actually picks up conditional comments for IE9. The only way I was able to fix was add a conditional comment like this:

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

And then prefix relevant styles with the .ieMobile75 class. If you want to avoid those styles hitting desktop IE, I'd suggest combining them inside a media query.



回答3:

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

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