Freigeben über


Identifying Pocket Internet Explorer to a Web Server (Windows CE 5.0)

Send Feedback

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 the mobile Internet browser 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

For Windows Mobile-based Pocket PCs, the following specific information is included in the HTTP request header when the mobile Internet browser sends a request to an HTTP server.

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.

For Windows Mobile-based Smartphones, 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 (SMARTPHONE) - Version 4.1}
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 mobile Internet 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 devices. 
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 device.
var isCE = strNav.indexOf("Windows CE");
   if(isCE > -1) {
      // Add Windows CE-specific code.
   }
   else {
      // Add code for other devices.
   }

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 devices.
   }

Additional information about using the browser capabilities in IIS to deliver dynamic, interactive Web pages is available at this Microsoft Web site.

See Also

Pocket Internet Explorer Application Development

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.