Thursday, February 28, 2002
User Agent strings
Posted by Andy Sjostrom in "DEVELOPER" @ 01: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:
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)
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.
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)
Public IsPPC, IsMME, IsThinClient
IsPPC = (InStr(Request.ServerVariables("HTTP_USER_AGENT"), "Windows CE") > 0)
IsMME = (InStr(Request.ServerVariables("HTTP_USER_AGENT"), "MME") > 0)
IsThinClient = (IsPPC Or IsMME)
Of course... the Microsoft Mobile Internet Toolkit and the Mobile Controls do this elegantly from out of the box...!
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)
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.
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)
Public IsPPC, IsMME, IsThinClient
IsPPC = (InStr(Request.ServerVariables("HTTP_USER_AGENT"), "Windows CE") > 0)
IsMME = (InStr(Request.ServerVariables("HTTP_USER_AGENT"), "MME") > 0)
IsThinClient = (IsPPC Or IsMME)
Of course... the Microsoft Mobile Internet Toolkit and the Mobile Controls do this elegantly from out of the box...!