Changes afoot:
We recently made a change in the next version of IE Mobile for Windows Mobile, regarding the IE Mobile User-Agent string. It was a little (ok - a lot!) out of date, and it really didn't suit our needs. It was a relic of a long ago fragmented product that just didn't reflect the current state of the browser.
What we discovered as we updated the string was that many sites that thought they were properly detecting IE Mobile really weren't doing it the right way. Our own MSN sites had a few problems, which they're updating, so that they'll be ready to go when the new crop of devices hits the market. We've even talked to some very friendly fellows at a big, popular rival search engine company and made sure their seach page will render right when these devices ship.
In the interests of helping fix the broken sites out there now, and getting people ready for the future, we're releasing our new User-Agent string right here, along with a pointer to some other information.
Out with the old:
For Windows Mobile 5.0, our "current" release, the User-Agent header that the browser sends across is one of the following two strings:
- Mozilla/4.0 (compatible; MSIE 4.01; Windows CE; PPC; 240x320)
- Mozilla/4.0 (compatible; MSIE 4.01; Windows CE; Smartphone; 176x220)
Some of the really broken sites we've seen were looking for the resolution information, and using that to deliver a mobile page. That's wrong, because that information may be absent on some devices from the User-Agent string (more about that in a minute...)
Others were using one of many badly written samples out there on the net, finding only, "MSIE 4.01," then kicking the browser out of the site, because they wanted IE 5.5 or IE 6.0 only.
If you want to detect the current/older IE Mobile browsers, the way to do it is to look for "PPC" or "Smartphone", as well as "Windows CE" in that string. That's the only sure-fire way to be certain of what you're getting.
In with the new:
Moving forward, here's the new IE Mobile User-Agent string:
- Mozilla/4.0 (compatible; MSIE 6.0; Windows CE; IEMobile m.n)
The "m.n" portion is a version number, like "6.7", which can help you page and site authors address feature set. It also lets us know what to look for when debugging our customer's problems, as each manufacturer often gets a slightly different variant of Windows Mobile with a lot of QFEs for their specific needs. When this new browser makes it into the "wild" on devices, we'll let you get a list, likely via MSDN, of what we update for each release, so you can decide if you want to take advantage of the new features.
If you want to detect the new browsers coming out, just look for the string "IEMobile" as part of the User-Agent header. Since the capabilities of the Pocket PC and Smartphone versions of the browser are identical, and they're built from the identical code base, there's no reason to differentiate them any more.
Mixing it up:
We're also being a little more hard-core about modification to the string. In the past, OEMs and mobile operators could change this string. We've locked it down now, although they can still append to it, after the closing parenthesis. We feel that it's really important that page authors can truthfully and honestly detect IE Mobile, but we still want to allow our OEMs a little room to add additional package information, device strings, or whatever to that header. We just don't want to delete things that are really important, like that "IEMobile" information!
Getting the big picture:
At first glance, it might look like we removed useful stuff from the User-Agent header, but that's not the case. We've always sent a batch of additional headers along that contain all the good stuff, which you should use if you need more information to render a page properly. They're designed for this type of work; sniffing the User-Agent isn't. We've got information available as to screen size, color depth, operating system, CPU type, and even if VoIP is supported.
The additional headers we send are:
- UA-pixels: {i.e. 240x320}
- UA-color: {mono2 | mono4 | color8 | color16 | color24 | color32}
- UA-OS: {Windows CE (POCKET PC) - Version 3.0}
- UA-CPU = {i.e. ARM SA1110}
- UA-Voice = {TRUE | FALSE}
These headers have been around (other than UA-voice) since at least Windows Mobile 2002, and their purpose is to help you make rendering decisions if you have to do layout adjustments.
Note that on Smartphones, we may not have the UA-CPU information; it's a privileged API, and we run unprivileged, for security purposes. The newer release will fix this, as we can at least tell you ARM or X86 builds, even if we can't locate the processor specifics.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcepie/html/ceconidentifyingpocketinternetexplorertowebserver.asp has more information about these headers and using them with Internet Information Server.
In our latest update, UA-pixels, which has the screen size, will also change with portrait or landscape rotation, and, on HiDPI devices, which are capable of changing to high or low resolution, if the user changes the device screen size, the UA-Pixels header will reflect the change, as well.
Getting it exactly like you want it:
There's one more bit of information for page authors, and that's a particular META tag. If you want, you can build your page with:
- <meta name="MobileOptimized" content="width">
Setting it on your page can turn off all of our layout optimizations and do them all server-side or in HTML yourself, if you really want to be particular about how things look. More information, including a full set of parameters for the content field, is available at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/mobilesdk5/html/wce51conLayoutMetaTag.asp
That tag, in particular, tells us to skip our fit-to-screen rendering decisions, and just view the page in the equivalent of "Desktop" view mode. It's really useful if you try to build pages or sites that are targeted towards mobile end users.
-Cameron