Browser Capabilities Component

The Browser Capabilities component creates a BrowserType object that provides your scripts with a description of the capabilities of the client's Web browser.

When a browser connects to the Web server, it automatically sends an HTTP User Agent header. This header is an ASCII string that identifies the browser and its version number. The BrowserType object compares the header to entries in the Browscap.ini file.

If it finds a match, the BrowserType object assumes the properties of the browser listing that matched the User Agent header.

If the object does not find a match for the header in the Browscap.ini file, it searches for the closest match using the * and ? wildcards. If a match can not be found using wildcards, the object will use the default browser settings if they have been specified in the Browscap.ini file. If the object does not find a match and default browser settings have not been specified in the Browscap.ini file, the object sets every property to the string "UNKNOWN."

You can add properties or new browser definitions to this component simply by updating the Browscap.ini file.

File Names
Browscap.dll The Browser Capabilities component.
Browscap.ini A text file that maps browser capabilities to the HTTP User Agent header. This file must be in the same directory as Browscap.dll.

Syntax

Set BrowserType = Server.CreateObject("MSWC.BrowserType")

Parameters
BrowserType
Specifies the name of the BrowserType object created by the call to Server.CreateObject.
Example

The following example uses the BrowserType object to display a table showing some of the capabilities of the current browser.

<%  Set bc = Server.CreateObject("MSWC.BrowserType") %>  
<TABLE BORDER=1> 
<TR><TD>Browser</TD><TD>  <%= bc.browser  %>  
<TR><TD>Version</TD><TD>  <%= bc.version  %>  </TD></TR> 
<TR><TD>Frames</TD><TD>
<%  if (bc.frames = TRUE) then  %>  TRUE
<%  else  %>  FALSE
<%  end if  %> </td></TR> 
<TR><TD>Tables</TD><TD>
<%  if (bc.tables = TRUE) then  %>  TRUE 
<%  else  %> FALSE
<%  end if  %> </TD></TR> 
<TR><TD>BackgroundSounds</TD><TD> 
<%  if (bc.BackgroundSounds = TRUE) then  %>  TRUE 
<%  else  %> FALSE
<%  end if  %> </TD></TR> 
<TR><TD>VBScript</TD><TD> 
<%  if (bc.vbscript = TRUE) then  %>  TRUE 
<%  else  %> FALSE
<%  end if  %> </TD></TR> 
<TR><TD>JScript</TD><TD> 
<%  if (bc.javascript = TRUE) then  %>  TRUE 
<%  else  %> FALSE
<%  end if  %> </TD></TR> 
</TABLE>