1 out of 6 rated this helpful - Rate this topic

clientCaps Behavior

Provides information about features supported by Windows Internet Explorer, as well as a way for installing browser components on demand.

Syntax

XML <Prefix: CustomTag ID=sID STYLE="behavior:url('#default#clientCaps')" />
HTML <ELEMENT STYLE="behavior:url('#default#clientCaps')" ID=sID>
Scripting object .style.behavior = "url('#default#clientCaps')"
object .addBehavior ("#default#clientCaps")

Possible Values

Prefix Prefix that associates the CustomTag with an XML namespace. This prefix is set using the XMLNS attribute of the HTML tag.
CustomTag User-defined tag.
sID String that specifies a unique identifier for the object.

Members Table

The following table lists the members exposed by the clientCaps object.

Attributes/Properties
Property Description
availHeight Retrieves the height of the working area of the system's screen, excluding the Windows taskbar.
availWidth Retrieves the width of the working area of the system's screen, excluding the Windows taskbar.
bufferDepth Retrieves the number of bits per pixel used for colors on the off-screen bitmap buffer.
colorDepth Retrieves the number of bits per pixel used for colors on the destination device or buffer.
connectionType Retrieves the type of connection in use.
cookieEnabled Specifies whether client-side cookies are enabled in the browser.
cpuClass Retrieves a string representing the CPU class.
height Retrieves the vertical resolution of the screen.
javaEnabled Retrieves whether the Microsoft virtual machine (Microsoft VM) is enabled.
platform Retrieves the platform on which the browser is running.
systemLanguage Retrieves the default language that the system is running.
userLanguage Retrieves the current user language.
width Retrieves the horizontal resolution of the screen.
Methods
Method Description
addComponentRequest Adds the specified component to the queue of components to be installed.
clearComponentRequest Clears the queue of all component download requests.
compareVersions Compares two version numbers.
doComponentRequest Downloads all the components that have been queued using addComponentRequest.
getComponentVersion Retrieves the version of the specified component.
isComponentInstalled Retrieves whether the specified component is available.

Remarks

The members listed in the preceding table might not be accessible through scripting until the window.onload event fires. Waiting for this event to fire ensures that the page is completely loaded, that all behaviors have been applied to corresponding elements on the page, and that all the behavior's properties, methods, and events are available for scripting. To prevent a scripting error—which would indicate that the object does not support a particular member—do not use any of the behavior-defined members before the window.onload event fires.

The clientCaps behavior is available as of Microsoft Internet Explorer 5, in the Microsoft Win32 and Unix platforms.

Examples

This example retrieves all the properties exposed by the clientCaps behavior.


<HTML XMLNS:IE>
<HEAD>
<STYLE>
@media all {
   IE\:clientCaps {behavior:url(#default#clientCaps)}
}   
</STYLE>
</HEAD>

<BODY>
<IE:clientCaps ID="oClientCaps" />

<PRE id=oPre></PRE>

<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>
</BODY>
</HTML>

Code example: http://samples.msdn.microsoft.com/workshop/samples/author/behaviors/clientCaps/ccProperties.htm

This example uses the getComponentVersion method of the clientCaps behavior to determine the browser version.


<SCRIPT>
function window.onload()
{
    var sVersion = oClientCaps.getComponentVersion ("{89820200-ECBD-11CF-8B85-00AA005B4383}","componentid");
	myText.innerHTML = "<FONT SIZE=4>You are running Internet Explorer " + sVersion + ".</FONT>";
}
</SCRIPT>


<BODY BGCOLOR="#FFFFFF" STYLE="behavior:url(#default#clientCaps)" ID="oClientCaps">
   :
<DIV ID="myText"></DIV>   

Code example: http://samples.msdn.microsoft.com/workshop/samples/author/behaviors/clientCaps/IE5Version.htm

This example shows how to install the Internet Explorer Data Binding component, if the component does not already exist in the user's system.


<HEAD>
<SCRIPT>
function window.onload()
{
   // dynamically set the behavior through script
   oClientCaps.style.behavior = "url(#default#clientCaps)";

   var bDBAvailable  = false;
   var sDBVersion = '';
   var sDBID = "{9381D8F2-0288-11D0-9501-00AA00B911A5}"; 
   
   bDBAvailable = oClientCaps.isComponentInstalled(sDBID,"componentid");

   // if data binding is unavailable, install it
   if (!bDBAvailable)
   {
      oClientCaps.addComponentRequest (sDBID, "componentid");
	  bDBAvailable = oClientCaps.doComponentRequest();
   }
   :
}
</SCRIPT>
</HEAD>

<BODY BGCOLOR="#FFFFFF" ID="oClientCaps">
  :
<PRE ID="preText"></PRE>
  

Code example: http://samples.msdn.microsoft.com/workshop/samples/author/behaviors/clientCaps/addDataBinding.htm

Applies To

A, ABBR, ACRONYM, ADDRESS, APPLET, AREA, B, BASE, BASEFONT, BDO, BGSOUND, BIG, BLOCKQUOTE, BODY, BR, BUTTON, CAPTION, CENTER, CITE, CODE, COL, COLGROUP, COMMENT, DD, DEL, DFN, DIR, DIV, DL, DT, EM, EMBED, FIELDSET, FONT, FORM, FRAME, FRAMESET, HEAD, hn, HR, HTML, I, IFRAME, IMG, INPUT type=button, INPUT type=checkbox, INPUT type=file, INPUT type=hidden, INPUT type=image, INPUT type=password, INPUT type=radio, INPUT type=reset, INPUT type=submit, INPUT type=text, INS, ISINDEX, KBD, LABEL, LEGEND, LI, LINK, LISTING, MAP, MARQUEE, MENU, nextID, NOBR, NOFRAMES, NOSCRIPT, OBJECT, OL, OPTION, P, PLAINTEXT, PRE, Q, RT, RUBY, S, SAMP, SCRIPT, SELECT, SMALL, SPAN, STRIKE, STRONG, SUB, SUP, TABLE, TBODY, TD, TEXTAREA, TFOOT, TH, THEAD, TITLE, TR, TT, U, UL, VAR, WBR, XML, XMP

See Also

Did you find this helpful?
(1500 characters remaining)

Community Additions

© 2013 Microsoft. All rights reserved.