Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to target Windows Mobile 7.5 browser using conditional comments?

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.

like image 920
timmackay Avatar asked Dec 14 '11 07:12

timmackay


2 Answers

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.

like image 177
Ben Frain Avatar answered Nov 15 '22 15:11

Ben Frain


may be this work for you

<!--[if IEMobile]>
...
<![endif]-->
like image 27
pravin Avatar answered Nov 15 '22 15:11

pravin