Identifying Pocket Internet Explorer to a Web Server

Microsoft Internet Information Services (IIS) can be used to provide customized views of your Web application based on information received from the user's browser. When a browser connects to the Web server, it automatically sends an HTTP User Agent header. This header is an ASCII string that identifies the browser and its version number. The BrowserType object compares the header to entries in the Browscap.ini file, which maps browser capabilities to the HTTP User Agent header.

Interacting with an IIS Web Server

To identify Pocket Internet Explorer browsers to an IIS Web Server, add the following lines to the Browsecap.ini file on the server.

[Mozilla/4.0 (compatible; MSIE 4.01; Windows CE)]
browser=Pocket Internet Explorer
version=4.1
majorver=#4
minorver=#1
platform=Windows CE
;Specify width of display on target device here.
;This example specifies 240 pixels.
width=240
;Specify height of display on target device here.
;This example specifies 320 pixels.
height=320
cookies=TRUE
frames=TRUE
backgroundsounds=TRUE
javaapplets=FALSE
javascript=TRUE
vbscript=FALSE
tables=TRUE
activexcontrols=TRUE

Interacting with an HTTP Server

When Pocket Internet Explorer sends a request to an HTTP server, the following specific information is included in the HTTP request header.

UA-pixels: {for example, 240x320}
UA-color: {mono2 | mono4 | color8 | color16 | color24 | color32}
UA-OS: {for example, Windows CE (POCKET PC) - Version 4.1}
UA-CPU = {for example, MIPS R4111}
UA-Voice = {TRUE | FALSE}
// Indicates whether device supports voice telephony.

Identifying a Window CE-based Client

The following Active Server Pages (ASP) server-side script identifies a client as Windows CE-based and sends pages that are optimized for a Windows CE-based browser.

'Check for Windows CE.
if (InStr(Request.ServerVariables("HTTP_USER_AGENT"), "Windows CE")) then
   // Add Windows CE-specific code. 
else
   // Add code for other platforms. 
end if

The following client-side script identifies a Windows CE-based device to the server and requests pages that are optimized for a Windows CE-based browser.

   var strNav = navigator.userAgent;
// Check for Windows CE-based platform.
var isCE = strNav.indexOf("Windows CE");
   if(isCE > -1) {
      // Add Windows CE-specific code.
   }
   else {
      // Add code for other platforms.
   }

The following Microsoft JScript® script checks for the presence of a specific device, MyCEDevice, which has a display size of 240 x 320 pixels.

   var isMyCEDevice = strNav.indexOf("240x320");
      if(isMyCEDevice > -1) {
       // Add device-specific code.
   }
   else {
      // Add code for other platforms.
   }

For more information about using the browser capabilities component in IIS to deliver dynamic, interactive Web pages, see the Microsoft Internet Information Services 5.1 documentation at this Microsoft Web site.

See Also

Pocket Internet Explorer

 Last updated on Saturday, April 10, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.