You can declare property definitions for any number of browsers in the Browscap.ini file. You can also set default values to use if the client’s browser is not one of the listed definitions.
For each browser definition, you provide a HTTP User Agent header and the properties and values you wish to associate with that header. For more information on the format of the HTTP User Agent header, refer to the HTTP specification available at http://www.w3.org/.
[; comments]
[HTTPUserAgentHeader]
[parent = browserDefinition]
[property1 = value1]
…
[propertyN = valueN]
[Default Browser Capability Settings]
[defaultProperty1 = defaultValue1]
…
[defaultPropertyN = defaultValueN]
comments
Any line that starts with a semicolon (;). Comments, which are ignored by the Browser Capabilities component, can occur anywhere in the Browscap.ini file.
HTTPUserAgentHeader
Specifies the HTTP User Agent header to associate with the browser-property value statements specified in propertyN. The Browscap.ini file may contain multiple browser definitions, each one starting with a unique HTTPUserAgentHeader value.
You can use the asterisk (*) character as a wildcard character in the HTTPUserAgentHeader to replace zero or more characters.
For example, if you specified the following string for HTTPUserAgentHeader:
[Mozilla/2.0 (compatible; MSIE 3.0;* Windows 95)]
It would match all of the following User Agent headers:
[Mozilla/2.0 (compatible; MSIE 3.0; Windows 95)] [Mozilla/2.0 (compatible; MSIE 3.0; AK; Windows 95)] [Mozilla/2.0 (compatible; MSIE 3.0; SK; Windows 95)] [Mozilla/2.0 (compatible; MSIE 3.0; AOL; Windows 95)]
Note The Browser Capabilities component first attempts to match exactly the User Agent header to a value of HTTPUserAgentHeader. If that fails, it attempts to make a match that uses wildcard characters.
If more than one browser definition containing wildcard characters matches the User Agent header, the Browser Capabilities component returns the properties of the first matching definition.
browserDefinition
An optional parameter specifying the HTTP User Agent header-string of a browser to use as the parent browser. The current browser's definition will inherit all of the property values declared in the parent browser's definition. This helps define properties for a new version of a browser, because new versions usually retain most of the properties of the previous release. These inherited property values can be overwritten by explicitly setting a new value for the property by using the syntax propertyN = valueN.
propertyN
An optional parameter specifying the name of the browser property to set. It must start with an alphabetic character and cannot be longer than 255 characters. Each browser definition in the Browscap.ini file can contain as many statements of property values as needed. For example, if your application only needed to know whether or not a user's browser supported VBScript, you would only need one property statement for each browser definition.
The following table lists some possible properties:
Property |
Description |
ActiveXControls |
Specifies whether the browser supports ActiveX™ controls. |
backgroundsounds |
Specifies whether the browser supports background sounds. |
beta |
Specifies whether the browser is beta software. |
browser |
Specifies the name of the browser. |
cookies |
Specifies whether the browser supports cookies. |
frames |
Specifies whether the browser supports frames. |
javascript |
Specifies whether the browser supports JScript™. |
platform |
Specifies the platform that the browser runs on. |
tables |
Specifies whether the browser supports tables. |
vbscript |
Specifies whether the browser supports VBScript. |
version |
Specifies the version number of the browser. |
valueN
An optional parameter specifying the value of propertyN. This value is a string by default. To specify an integer, prefix the value with a number sign (#). To specify a Boolean value, use TRUE or FALSE.
defaultPropertyN
An optional parameter specifying the name of the browser property to which to assign a default value if none of the defined HTTPUserAgentHeader values match the HTTP User Agent header sent by the browser.
defaultValueN
An optional parameter specifying the value of defaultPropertyN. This value is a string by default. To specify an integer, prefix the value with a number sign (#). To specify a Boolean value, use TRUE or FALSE.
In the following example, the parent tag allows the second browser definition to inherit from the first, so that the Microsoft® Internet Explorer 3.01 definition inherits all the properties of Microsoft® Internet Explorer 3.0 definition (eg: frames=TRUE, tables=TRUE, and cookies=TRUE). It adds platform-specific information by adding the line, platform=Win95, and overwrites the version information in the line, version=3.01.
;;ie 3.0 [IE 3.0] browser=IE Version=3.0 majorver=#3 minorver=#0 frames=TRUE tables=TRUE cookies=TRUE backgroundsounds=TRUE vbscript=TRUE javascript=TRUE ActiveXControls=TRUE Win16=False beta=False AK=False SK=False AOL=False ;;ie 3.01 [Mozilla/2.0 (compatible; MSIE 3.01*; Windows 95)] parent=IE 3.0 version=3.01 minorver=01 platform=Win95 ; Default Browser [Default Browser Capability Settings] browser=Default frames=FALSE
tables=TRUE
cookies=FALSE
backgroundsounds=FALSE
vbscript=FALSE
javascript=FALSE
© Microsoft Corporation. All rights reserved.
file: /Techref/language/asp/comp/compref_11.htm, 8KB, , updated: 1996/11/21 18:01, local time: 2024/12/17 23:12,
3.138.137.212:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://ecomorder.com/techref/language/asp/comp/compref_11.htm"> Browscap.ini File</A> |
Did you find what you needed? |
Welcome to ecomorder.com! |
Welcome to ecomorder.com! |
.