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

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

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

Does conditional comment syntax style work for targeting on Windows Mobile?

EDIT: Thanks to the comment below, I was able to find a solution. The syntax The <!--[if IEMobile]> <[end if]--> works for Windows Mobile 7, but I could not get it to work for Windows Mobile 7.5. Since I am creating a mobile website that does not need to be presented well on desktop devices, I was able to use the general comment <!--[if gt IE 7]> , which addresses the problem I was experiencing between the two visualizations.

If someone has a more elegant solution when it doesn’t work due to the required desktop support, I would like to hear it.

+6
source share
3 answers

maybe this work is for you

 <!--[if IEMobile]> ... <![endif]--> 
+1
source

Just in case, someone is faced with this problem. Some points worth knowing:

IE Mobile 7.5 reports a false value for the font. So you are out of luck with this feature with Modernizr.

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

 <!--[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 the prefix of the corresponding styles with the class .ieMobile75 . If you want these styles not to get into the IE desktop, I would suggest combining them inside a media query.

+2
source
 <pre> <code> is this help for you by checking device width? <!-- [if (min-device-width: 481px)]> <![endif]β€”> </code> </pre> 
0
source

Source: https://habr.com/ru/post/903734/


All Articles