# 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 File | 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.

--- Browscap.asp ---

    <%  Set bc = Server.CreateObject("MSWC.BrowserType") %>

    <TABLE BORDER=1 CELLPADDING=4>
      <TR>
      <TD>Browser</TD>
      <TD><%= bc.browser %>
      <TR>
      <TD>Version</TD>
      <TD><%= bc.version %></TD>
      </TR>
      <TR>
      <TD>Frames</TD>
      <TD><%= bc.frames %></TD>
      </TR>
      <TR>
      <TD>Tables</TD>
      <TD><%= bc.tables  %></TD>
      </TR>
      <TR>
      <TD>Cookies</TD>
      <TD><%= bc.cookies  %></TD>
      </TR>
      <TR>
      <TD>BackgroundSounds</TD>
      <TD><%= bc.BackgroundSounds %></TD>
      </TR>
      <TR>
      <TD>VBScript</TD>
      <TD><%= bc.vbscript %></TD>
      </TR>
      <TR>
      <TD>JScript</TD>
      <TD><%= bc.javascript %></TD>
      </TR>
      <TR>
      <TD>ActiveX Controls</TD>
      <TD><%= bc.ActiveXControls %></TD>
      </TR>
    </TABLE>

© 1997-2001 Microsoft Corporation. All rights reserved.