ASP Browser Capabilities
Component
ASP Browser Capabilities Component
The ASP Browser Capabilities component creates a BrowserType object that can determine the type, capabilities, and version number of the visitor's browser.
When a browser connects to the server, it sends a HTTP User Agent header to the server. This header contains information about the browser.
The BrowserType object compares the information in the header with the information in a file named "Browscap.ini" on the server.
If the browser type and version number in the header match the information in the "Browscap.ini" file, we can use the BrowserType object to list the properties of this matching browser. If there is no match, the object sets each property to "UNKNOWN".
Syntax
ASP Browser Capabilities Example
The following example creates a BrowserType object in an ASP file and displays some information about the current browser's capabilities:
Example
Output:
Client OS | WinNT |
---|---|
Web Browser | IE |
Browser version | 5.0 |
Frame support? | True |
Table support? | True |
Sound support? | True |
Cookies support? | True |
VBScript support? | True |
JavaScript support? | True |
Browscap.ini File
The "Browscap.ini" file is used to declare properties and set default values for various browsers.
This section is not a tutorial on how to maintain the Browscap.ini file. We only provide some basic knowledge and concepts about "Browscap.ini" to give you a general understanding of the file.
The "Browscap.ini" file can contain the following information:
Parameter | Description |
---|---|
comments | Optional. Any line starting with a semicolon is ignored by the BrowserType object. |
HTTPUserAgentHeader | Optional. Specifies the HTTP User Agent header associated with the browser-property value declaration in propertyN. Wildcards are allowed. |
browserDefinition | Optional. Specifies an HTTP User Agent header-string of a browser to be used as a parent browser. The current browser definition inherits all declared property values from the parent browser definition. |
propertyN | Optional. Specifies a browser property. The following table lists some possible properties: ActiveXControls - Supports ActiveX® controls?<br> Backgroundsounds - Supports background sounds?<br> Cdf - Supports Channel Definition Format for webcasting?<br> Tables - Supports tables?<br> Cookies - Supports cookies?<br> Frames - Supports frames?<br> Javaapplets - Supports Java applets?<br> Javascript - Supports JScript?<br> Vbscript - Supports VBScript?<br> Browser - Specifies the browser name<br> Beta - Is the browser beta software?<br> Platform - Specifies the platform the browser runs on<br> Version - Specifies the browser version number |
valueN | Optional. Specifies the value of propertyN. Can be a string, integer (prefixed with #), or boolean value. |
defaultPropertyN | Optional. Specifies the name of a browser property, and assigns a default value to this property if no value in the defined HTTPUserAgentHeader matches the HTTP User Agent header sent by the browser. |
defaultValueN | Optional. Specifies the value of defaultPropertyN. Can be a string, integer (prefixed with #), or boolean value. |
The "Browscap.ini" file might look like this: