Microsoft 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.

Contributed by
Rating: 5 stars5 stars5 stars5 stars5 stars / 1
January 01, 2002
Rate this Article:
MEH MEH++


SEARCH ASP FREE
TOOLS YOU CAN USE

advertisement

 

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.dllThe Browser Capabilities component.
Browscap.iniA 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>
blog comments powered by Disqus
ASP ARTICLES

- Using MySQL with ASP
- ADO for the Beginner
- ADO.NET 101: Data Rendering with a DataGrid ...
- Introducing SoftArtisans OfficeWriter 3.0 En...
- Getting Remote Files With ASP
- The Real Basics of Functions in ASP
- Enhancing Readability with ASP
- Mimicking PHP's String Formatting Functions
- Windows Server Hacks 12, 77, and 98
- How to Sort a Multi-Dimensional Array
- Developing an Information Management Tool wi...
- What are Active Server Pages?
- Getting Remote Pages with ASP
- FTP’ing Files with ASP
- Apply Single-Sign-On to Your Application

ASP Web Hosting ASP.Net Web Hosting Windows Web Hosting
 
 
 

ASP Free Forums 
 RSS  Tutorials RSS
 RSS  Forums RSS
 RSS  All Feeds
Site Map 
Request Media Kit
Write For Us Get Paid 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Privacy Policy 
Support 


© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 7 - Follow our Sitemap
Most Popular Topics
All ASP.Net Tutorials