<%@ Page %>
Detecting Browser Capabilities
Introduction
Many web applications provide client side functionality based on the capabilities of browser. ASP.NET provides an easy way to get capabilities of browsers. The capabilities of a browser include things such as whether it supports cookies, javascript and ActiveX controls and browser type and version. Based on these capabilities you can decide whether to provide rich DHTML functionality or render page differently.
Browser Capabilities
The capabilities of browser are accessible from Request.Browser property. This property returns an instance of System.Web.HttpBrowserCapabilities class. The HttpBrowserCapabilities class contains many read only properties that tell us more about browser. Following table lists various properties of HttpBrowserCapabilities class and their values on my machine:
ActiveXControls | True |
AOL | False |
BackgroundSounds | True |
Beta | False |
Browser | IE |
CDF | False |
ClrVersion | 1.0.3705 |
Cookies | True |
Crawler | False |
EcmaScriptVersion | 1.2 |
Frames | True |
JavaApplets | True |
JavaScript | True |
MajorVersion | 6 |
MinorVersion | 0 |
MSDomVersion | 6.0 |
Platform | WinNT |
Tables | True |
TagWriter | System.Web.UI.HtmlTextWriter |
Type | IE6 |
VBScript | True |
Version | 6.0 |
W3CDomVersion | 1.0 |
Win16 | False |
Win32 | True |
Sample Code
The article includes a sample code that displays above properties and their values. You can test it by creating a VS.NET web project and adding the files to it.
Bipin Joshi is an independent software consultant, trainer, author, yoga mentor, and meditation teacher. He has been programming, meditating, and teaching for 24+ years. He conducts instructor-led
online training courses in ASP.NET family of technologies for individuals and small groups. He is a published author and has authored or co-authored books for Apress and Wrox press. Having embraced the Yoga way of life he also teaches
Ajapa Yoga to interested individuals. To know more about him click
here.
Get connected :
Facebook Twitter LinkedIn YouTube