Log in

View Full Version : User Agent strings


Andy Sjostrom
02-28-2002, 09:17 AM
Web masters that are looking for ways to transform web pages based on what browser requests the pages will find these little strings useful:<br /><br />Pocket PC 2002<br />Mozilla/2.0 (compatible; MSIE 3.02; Windows CE; PPC; 240x320)<br /><br />Smartphone 2002<br />Mozilla/2.0 (compatible;MSIE 3.02;Windows CE; Smartphone; 176x220)<br /><br />These are the User Agent strings that the Pocket PC 2002 and Smartphone 2002 sends to the web server when requesting a page. By intercepting the User Agent string, content can be programmatically transformed or the browser can just be redirected to another page.<br /><br />The following couple lines of ASP code illustrate one way of reading the User Agent string to set boolean values, that later on can be used to decide what content to send from the web server. (This code executes on businessanyplace.net. Developer: Chris Forsberg)<br /><br />Public IsPPC, IsMME, IsThinClient<br />IsPPC = (InStr(Request.ServerVariables("HTTP_USER_AGENT"), "Windows CE") > 0)<br />IsMME = (InStr(Request.ServerVariables("HTTP_USER_AGENT"), "MME") > 0)<br />IsThinClient = (IsPPC Or IsMME)<br /><br />Of course... the Microsoft Mobile Internet Toolkit and the Mobile Controls do this elegantly from out of the box...!

Ian Chia
02-28-2002, 11:45 AM
Pocket PC 2002
Mozilla/2.0 (compatible; MSIE 3.02; Windows CE; PPC; 240x320)

Smartphone 2002
Mozilla/2.0 (compatible;MSIE 3.02;Windows CE; Smartphone; 176x220)


Hi Andy,

Actually since a number of end users manually tweak Pocket IE's useragent variables in order to get through sites that lock out IE3, wouldn't it be better to detect for the HTTP_UA_OS variable?

PIE on a Pocket PC reports:

HTTP_UA_OS - Windows CE (POCKET PC) - Version 3.0
HTTP_UA_PIXELS - 240x320
HTTP_UA_VOICE - FALSE

I don't have access yet to a Smartphone, but I imagine the HTTP_UA_OS would stay the same, but the HTTP_UA_PIXELS and HTTP_UA_VOICE variables would change accordingly, giving developers a more bulletproof way to detect for Pocket PC and SmartPhone devices.

Just a thought.

Regards,

- Ian

innersky
02-28-2002, 11:59 AM
I knew I was right about the Smartphone screen resolution :)

Andy Sjostrom
02-28-2002, 12:49 PM
I often choose not to use the UA variables, since IE is the only browser that uses them, AFAIK.., but since this is a situation where IE is the only browser that I want to detect... so, here we go:

Pocket PC 2002:
HTTP_UA_OS - Windows CE (POCKET PC) - Version 3.0
HTTP_UA_PIXELS - 240x320
HTTP_UA_VOICE - FALSE

Smartphone 2002:
HTTP_UA_OS - Windows CE (smartfon) - Version 3.0
HTTP_UA_PIXELS - 176x220
HTTP_UA_VOICE - TRUE

"smartfon"!? A typo w a European twist? (Phone in Swedish is "telefon")

Ian Chia
02-28-2002, 01:54 PM
HTTP_UA_OS - Windows CE (smartfon) - Version 3.0


Andy,

Thanks for the above. Did you get the "smartfon" from an emulator in the SDK or is it actually from a real device? Seems a little strange that it's lower case compared to "Pocket PC" and in a different language.

I haven't got my SDK yet, so a little in the dark here.

Does the SDK doco say anything about the UA_OS variable?

Many thanks,

- Ian

Andy Sjostrom
02-28-2002, 02:42 PM
The strings are retrieved from the emulator in the SDK.
The SDK says many things about most things, but not too much specifically regarding the UA_OS. :D

-Andy.

Ian Chia
02-28-2002, 02:51 PM
And a final question, if you're feeling generous Andy. Thanks for taking the time to reply so far.

Does the SmartPhone still render ActiveX controls within Pocket IE, just like the Pocket PC? eg. For example, does the MonthCal ActiveX from the PPC2002 SDK sample work within the SmartPhone SDK?

Many thanks,

- Ian