Open Directory Site ASP Tutorials

ASP | XML | VBScript | JavaScript | ADO | CSS | XMLDOM | PHP | Operating Systems

Home >> ASP >> ASP Browser Capabilities

ASP Browser Capabilities

 

Browser Capabilities

The Browser Capabilities component creates a BrowserType object that determines the type, capabilities and version of each browser that visits your site.

An HTTP User Agent Header is sent to the server when a browser connects to it. This header identifies the browser and the browser version. 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 sets every property to "UNKNOWN".

The file "Browscap.ini" is a text file on the server that maps browser capabilities to the HTTP User Agent header.

Syntax

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

Examples

1. The Browser Capabilities Component

This component determines the type, capabilities and version of each browser that visits your site.

Coding

<html>

<body>

<%

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

%>

<table border="1" width="65%">

<tr>

<td width="52%">Client OS</td>

<td width="48%"><%=MyBrow.platform%></td>

</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 Unknown

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

Cheap Web Hosting Articles - Web Site Design & Web Hosting Tutorials - Domain Hosting