Using Client Capabilities (Windows CE 5.0)

Send Feedback

Client capabilities consist of information about a client's browsing environment, such as screen resolution, screen dimensions, color depth, CPU, or connection speed. Web applications use this information to enhance a user's experience by customizing content based on the capabilities that the client browser supports. For example, in response to a request from a browser application running on a handheld device with a 2" x 3" display, a server can reformat a Web page that was originally designed for a 24" diameter display to a format that is easier to view on the smaller display.

While it is possible to obtain client capabilities through the use of cookies, this approach is inefficient, because it requires repeated communication between the client and the server, which must then generate a custom page for each client request. In Internet Explorer 6 for Windows CE, client capabilities are exposed as default DHTML behaviors of the browser, through the clientCapsBehavior object. In response to a client request for a page, the server sends the page, along with a client-side script for obtaining the necessary information. In addition to providing information about the client browser, the clientCaps object provides a means of installing browser components on demand.

The following table shows the client capabilities that can be determined through the clientCaps behavior object in Internet Explorer 6 for Windows CE.

Property DHTML implementation Description
availHeight window.screen.availHeight Retrieves the height of the working area of the system's screen, excluding the Windows taskbar.
availWidth window.screen.availWidth Retrieves the width of the working area of the system's screen, excluding the Windows taskbar.
bufferDepth window.screen.bufferDepth Sets or retrieves the number of bits per pixel used for colors in the off-screen bitmap buffer.
colorDepth window.screen.colorDepth Retrieves the number of bits per pixel used for colors on the destination device or buffer.
height window.screen.height Retrieves the vertical resolution of the screen.
width window.screen.width Retrieves the horizontal resolution of the screen.
cookieEnabled window.navigator.cookieEnabled Retrieves whether client-side cookies are enabled in the browser.
cpuClass window.navigator.cpuClass Retrieves a string denoting the CPU class.
platform window.navigator.platform Retrieves the name of the user's operating system.
systemLanguage window.navigator.systemLanguage Retrieves the default language used by the system.
userLanguage window.navigator.userLanguage Retrieves the current user language.

Windows CE also provides limited support for two clientCaps object methods — getComponentVersion and isComponentInstalled. These methods can only:

  • Retrieve a component that is listed with its CLSID in the registry key [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\.
  • Accept references of type ComponentID. All other references return E_INVALIDARG.

Note   Because Internet Explorer for Windows CE does not support the downloading of ActiveX controls, there is no support for other clientCaps object methods.

The following code example shows how to use the clientCaps object to obtain information about client-side capabilities.

<SCRIPT>
<!--
function window.onload()
{
   sTempStr = "availHeight    = " + oClientCaps.availHeight    + "\n" + 
              "availWidth     = " + oClientCaps.availWidth     + "\n" + 
              "bufferDepth    = " + oClientCaps.bufferDepth    + "\n" +
              "colorDepth     = " + oClientCaps.colorDepth     + "\n" +
              "connectionType = " + oClientCaps.connectionType + "\n" +
              "cookieEnabled  = " + oClientCaps.cookieEnabled  + "\n" +  
              "cpuClass       = " + oClientCaps.cpuClass       + "\n" + 
              "height         = " + oClientCaps.height         + "\n" + 
              "javaEnabled    = " + oClientCaps.javaEnabled    + "\n" + 
              "platform       = " + oClientCaps.platform       + "\n" + 
              "systemLanguage = " + oClientCaps.systemLanguage + "\n" + 
              "userLanguage   = " + oClientCaps.userLanguage   + "\n" + 
              "width          = " + oClientCaps.width          + "\n" ;
  
   oPre.innerText = sTempStr;
}-->
</SCRIPT>

The following code example detects the number of colors available in the system, and assigns**the image with the appropriate number of colors to myImage.src. Thus, if 256 colors or more are detected, it displays a 256-color bitmap. Otherwise, it defaults to a lower resolution 16-color bitmap.

<SCRIPT>
<!--
function window.onload()
{
   if (window.screen.colorDepth >= 8)
      myImage.src = "lanma256.bmp"   
   else
      myImage.src = "lanman16.bmp";
}
-->
</SCRIPT>
<!--In BODY block this HTML code displays the image. -->
<P><IMG ID="myImage" height="317" width="489" border="0" alt="Windows splash screen"></P>

See Also

Internet Explorer MSHTML/DHTML API Application Development

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.