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 HTTPUserAgentHeader to replace zero or more characters and the (?) character as a wildcard to replace a single character.
For example, if you specified the following string for HTTPUserAgentHeader:
[Mozilla/4.0 (compatible; MSIE 5.0;* Windows NT)]
It would match all of the following User Agent headers:
[Mozilla/4.0 (compatible; MSIE 5.0; Windows NT)]
[Mozilla/4.0 (compatible; MSIE 5.0; AK; Windows NT)]
[Mozilla/4.0 (compatible; MSIE 5.0; SK; Windows NT)]
Note The BrowserType object first attempts to match the HTTP User Agent header to a value of HTTPUserAgentHeader exactly. 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 definition which most closely matches the User Agent header. The closest match is the match which replaces the fewest characters.
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 5.x definition inherits all the properties of Microsoft® Internet Explorer 5.0 definition (for example, frames=TRUE
, tables=TRUE
, and cookies=TRUE
). It adds platform-specific information by adding the line, platform=WinNT
.
;;ie 5.0
[IE 5.0]
browser=IE
Version=5.0
majorver=#5
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 5.x
[Mozilla/4.0 (compatible; MSIE 5.*; Windows NT)]
parent=IE 5.0
version=5.0
minorver=0
platform=WinNT
; Default Browser
[*]
browser=Default
frames=FALSE
tables=TRUE
cookies=FALSE
backgroundsounds=FALSE
vbscript=FALSE
javascript=FALSE