HBCMS更多的中文手册参考:

userAgent参数属性

DHTML文档教程

Retrieves a string equivalent to the HTTP user-agent request header.

dhtml语法

[ sUserAgent = ] object.userAgent

DHTML可能的值

sUserAgentStringthat specifies a valid HTTP user agent.

The property is read-only. The property has no default value.

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 6 returns the following string for microsoft windows® xp.

mozilla/4.0 (compatible; msie 6.0; windows nt 5.1)

Examples

This example uses the userAgent property to specify a required platform before additional script is executed. For example, if Windows XP is a requirement for the document, you can use a variable to determine whether the user is running the necessary operating system. The "bIsXP" variable is set to true if Windows XP is found in the userAgent value and the additional script is processed.

<SCRIPT>
var bIsXP=false;
window.onload=fnInit;
function fnInit(){
if(navigator.userAgent.indexOf("Windows NT 5.1")>-1){
bIsXP=true;
}
if(bIsXP==true){
// Process additional script.
}
}
</SCRIPT>

是否符合公共标准

There is no public standard that applies to this property.

Applies To

clientInformation, navigator

更多语法参考

About Conditional Comments