<P>This example shows how to use the new <B>clientCaps</B>
behavior, introduced in Microsoft Internet Explorer 5, to obtain
client capabilities information. The following is a sampling of the
information that can be obtained:</P>
Retrieves a string equivalent to the HTTP user-agent request header.
Syntax
HTML N/A
Scripting [ sUserAgent = ] object.userAgent
Possible Values
sUserAgent String爐hat specifies a valid HTTP user agent.
The property is read-only. The property has no default value.
Expressions can be used in place of the preceding value(s), as of Microsoft?Internet Explorer 5. For more information, see Dynamic Properties.
Remarks
The HTTP user-agent request header contains information about compatibility, the browser, and the platform name. For more information about the browser, see the appName property. For more information about the platform, see the appVersion property.
The userAgent property dynamically returns a different value depending on the browser and platform versions. For example, Microsoft?Internet Explorer 4.01 returns the following string for Microsoft ?Windows?95.
Mozilla/4.0 (compatible; MSIE 4.01; Windows 95)
Example
This example uses the userAgent property to specify a required platform before additional script is executed. For example, if Windows 95 is a requirement for the document, you can use a variable to determine whether the user is running the necessary operating system. The "bIs95" variable is set to true if Windows 95 is found in the userAgent value and the additional script is processed.
<SCRIPT>
var bIs95=false;
window.onload=fnInit;
function fnInit(){
if(navigator.userAgent.indexOf("Windows 95")>-1){
bIs95=true;
}
if(bIs95==true){
// Process additional script.
}
}
</SCRIPT>
Retrieves the name of the user's operating system.
Syntax
HTML N/A
Scripting [ sPlatform = ] object.platform
Possible Values
sPlatform String that receives one of the following values:HP-UX HP Unix-based machines.
MacPPC Macintosh PowerPC-based machines.
Mac68K Macintosh 68K-based machines.
SunOS Solaris-based machines.
Win32 Microsoft?Windows?32-bit platform.
Win16 Windows 16-bit platform.
WinCE Windows CE platform.
The property is read-only. The property has no default value.