I've developed a website which uses media queries to support mobile devices but开发者_StackOverflow中文版 Windows Mobile 7 doesn't seem to be affected. I know IE doesn't support media queries so I guess it's the same on WinMob. Is there any way to load a different page on this phone??
Just get the user agent and check if it is Windows Phone 7 (this is the samsung focus):
Mozilla/4.0 (compatible: MSIE 7.0; Windows Phone OS 7.0; Trident/3.1; IEMobile/7.0; SAMSUNG; SGH-i917)
Then redirect to another page.
You can use
<!--[IEMobile]>
<meta name="MobileOptimized" content="width" />
<link rel="stylesheet" type="text/css" href="ie-mobile.css"/>
<![endif]-->
But even better would be setting up for mobile-first, see the absence of Media Queries as a Media Query so to speak. And use:
<!--[if (lte IE 8)&!(IEMobile)]> <html lang="en" class="ieLte8"> <![endif]-->
So that you can use the selector: .ieLte8 to do the same as you would for medium displays via Media Queries.
精彩评论