JavaScript Editor JavaScript Editor     JavaScript Debugger

Previous Section Next Section

Main Page

Detecting Browser Type and Capabilities

Web applications can appear in various types of browsers, but the capabilities of your application may be restricted in browsers VB .NET calls "downlevel." A downlevel browser is one that only supports HTML 3.2. Uplevel browsers, on the other hand, support:

  • ECMAScript (the formal name for JavaScript) version 1.2

  • HTML version 4.0

  • The Microsoft Document Object Model (MSDOM)

  • Cascading style sheets (CSS)

To determine the type and capabilities of the target browser, you can use the properties of the Request.Browser object in the Page_Load event. You can find these properties in Table 14.8; these properties hold either text or a Boolean value (for example, Request.Browser.Frames returns a value of True if the browser supports frames, while Request.Browser.Browser will hold the text "IE" if the browser is the Internet Explorer).

Table 14.8: Request.Browser properties.

To find this:

Use this:

Browser type (example: IE6)

Request.Browser.Type

Browser name (example: IE)

Request.Browser.Browser

Version (example: 6.0b)

Request.Browser.Version

Major version (example: 6)

Request.Browser.MajorVersion

Minor version (example: 0)

Request.Browser.MinorVersion

Platform (example: WinNT)

Request.Browser.Platform

Is a beta version?

Request.Browser.Beta

Is an AOL browser?

Request.Browser.AOL

Is Win16?

Request.Browser.Win16

Is Win32?

Request.Browser.Win32

Supports frames?

Request.Browser.Frames

Supports tables?

Request.Browser.Tables

Supports cookies?

Request.Browser.Cookies

Supports VB Script?

Request.Browser.VBScript

Supports JavaScript?

Request.Browser.JavaScript

Supports Java Applets?

Request.Browser.JavaApplets

Supports ActiveX Controls?

Request.Browser.ActiveXControls

Previous Section Next Section




JavaScript Editor Free JavaScript Editor     JavaScript Editor