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 an 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]
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 BrowserType object 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 BrowserType object returns the properties of the first matching 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. |
cdf | Specifies whether the browser supports the Channel Definition Format for webcasting. |
cookies | Specifies whether the browser supports cookies. |
frames | Specifies whether the browser supports frames. |
Javaapplets | Specifies whether the browser supports Java applets. |
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. |
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 (for example, 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
javaapplets=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