- ASP.NET Web Pages - Tutorial
- ASP.NET Web Pages - Adding Razor Code
- ASP.NET Web Pages - Page Layout
- ASP.NET Web Pages - Folders
- ASP.NET Web Pages - Global Pages
- ASP.NET Web Pages - HTML Forms
- ASP.NET Web Pages - Objects
- ASP.NET Web Pages - Files
- ASP.NET Web Pages - Databases
- ASP.NET Web Pages - Helpers
- ASP.NET Web Pages - The WebGrid Helper
- ASP.NET Web Pages - The Chart Helper
- ASP.NET Web Pages - The WebMail Helper
- ASP.NET Web Pages - WebSecurity Object
- ASP.NET Web Pages - Publishing The Website
- ASP.NET Web Pages - Classes
- ASP.NET Razor - Markup
- ASP.NET Razor - C# And VB Code Syntax
- ASP.NET Razor - C# Variables
- ASP.NET Razor - C# Loops And Arrays
- ASP.NET Razor - C# Logic Conditions
- ASP.NET Razor - VB Variables
- ASP.NET Razor - VB Loops And Arrays
- ASP.NET Razor - VB Logic Conditions
- ASP Tutorial
- ASP Syntax
- ASP Variables
- ASP Procedures
- VBScript Conditional Statements
- VBScript Looping
- ASP Forms And User Input
- ASP Cookies
- ASP Session Object
- ASP Application Object
- ASP Including Files
- ASP The Global.asa File
- ASP AJAX
- ASP Sending E-mail With CDOSYS
- VBScript Functions
- VBScript Keywords
- ASP Response Object
- ASP Application Object
- ASP Session Object
- ASP Server Object
- ASP ASPError Object
- ASP FileSystemObject Object
- ASP TextStream Object
- ASP Drive Object
- ASP File Object
- ASP Folder Object
- ASP Dictionary Object
- ASP AdRotator Component
- ASP Browser Capabilities Component
- ASP Content Linking Component
- ASP Content Rotator Component (ASP 3.0)
- ASP Quick Reference
- ADO Introduction
- ADO Database Connection
- ADO Recordset
- ADO Display
- ADO Queries
- ADO Sort
- ADO Add Records
- ADO Update Records
- ADO Delete Records
- ADO Demonstration
- ADO Speed Up With GetString()
- ADO Command Object
- ADO Connection Object
- ADO Error Object
- ADO Field Object
- ADO Parameter Object
- ADO Property Object
- ADO Record Object
- ADO Recordset Object
- ADO Stream Object
- ADO Data Types
ASP Browser Capabilities Component
ASP Browser Capabilities Component
The ASP Browser Capabilities component creates a BrowserType object that determines the type, capabilities and version number of a visitor's browser.
When a browser connects to a server, a User Agent header is also sent to the server. This header contains information about the browser.
The BrowserType object compares the information in the header with information in a file on the server called "Browscap.ini".
If there is a match between the browser type and version number in the header and the information in the "Browscap.ini" file, the BrowserType object can be used to list the properties of the matching browser. If there is no match for the browser type and version number in the Browscap.ini file, it will set every property to "UNKNOWN".
Syntax
Set MyBrow=Server.CreateObject("MSWC.BrowserType")
%>
ASP Browser Capabilities Example
The example below creates a BrowserType object in an ASP file, and displays some of the capabilities of your browser:
Example
<html>
<body>
<%
Set MyBrow=Server.CreateObject("MSWC.BrowserType")
%>
<table border="0" width="100%">
<tr>
<th>Client OS</th><th><%=MyBrow.platform%></th>
</tr><tr>
<td >Web Browser</td><td ><%=MyBrow.browser%></td>
</tr><tr>
<td>Browser version</td><td><%=MyBrow.version%></td>
</tr><tr>
<td>Frame support?</td><td><%=MyBrow.frames%></td>
</tr><tr>
<td>Table support?</td><td><%=MyBrow.tables%></td>
</tr><tr>
<td>Sound support?</td><td><%=MyBrow.backgroundsounds%></td>
</tr><tr>
<td>Cookies support?</td><td><%=MyBrow.cookies%></td>
</tr><tr>
<td>VBScript support?</td><td><%=MyBrow.vbscript%></td>
</tr><tr>
<td>JavaScript support?</td><td><%=MyBrow.javascript%></td>
</tr>
</table>
</body>
</html>
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 |
Practice Excercise Practice now
The Browscap.ini File
The "Browscap.ini" file is used to declare properties and to set default values for browsers.
This section is not a tutorial on how to maintain "Browscap.ini" files, it only shows you the basics; so you get an idea what the file is all about.
The "Browscap.ini" file can contain the following:
[HTTPUserAgentHeader]
[parent=browserDefinition]
[property1=value1]
[propertyN=valueN]
[Default Browser Capability Settings]
[defaultProperty1=defaultValue1]
[defaultPropertyN=defaultValueN]
Parameter | Description |
---|---|
comments | Optional. Any line that starts with a semicolon are ignored by the BrowserType object |
HTTPUserAgentHeader | Optional. Specifies the HTTP User Agent header to associate with the browser-property value statements specified in propertyN. Wildcard characters are allowed |
browserDefinition | Optional. Specifies the HTTP User Agent header-string of a browser to use as the parent browser. The current browser's definition will inherit all of the property values declared in the parent browser's definition |
propertyN | Optional. Specifies the browser properties. The following table lists some possible properties:
|
valueN | Optional. Specifies the value of propertyN. Can be a string, an integer (prefix with #), or a Boolean value |
defaultPropertyN | Optional. Specifies the name of the browser property to which to assign a default value if none of the defined HTTPUserAgentHeader values match the HTTP User Agent header sent by the browser |
defaultValueN | Optional. Specifies the value of defaultPropertyN. Can be a string, an integer (prefix with #), or a Boolean value |
A "Browscap.ini" file might look something like this:
[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
beta=False
;DEFAULT BROWSER
[*]
browser=Default
frames=FALSE
tables=TRUE
cookies=FALSE
backgroundsounds=FALSE
vbscript=FALSE
javascript=FALSE
Practice Excercise Practice now
Products
Partner
Copyright © RVR Innovations LLP 2025 | All rights reserved - Mytat.co is the venture of RVR Innovations LLP