Meditation and Mindfulness for Software / IT Professionals. Conducted by Bipin Joshi in Thane. Read more...

<%@ 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:
ActiveXControlsTrue
AOLFalse
BackgroundSoundsTrue
BetaFalse
BrowserIE
CDFFalse
ClrVersion1.0.3705
CookiesTrue
CrawlerFalse
EcmaScriptVersion1.2
FramesTrue
JavaAppletsTrue
JavaScriptTrue
MajorVersion6
MinorVersion0
MSDomVersion6.0
PlatformWinNT
TablesTrue
TagWriterSystem.Web.UI.HtmlTextWriter
TypeIE6
VBScriptTrue
Version6.0
W3CDomVersion1.0
Win16False
Win32True

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 a software consultant, an author and a yoga mentor having 21+ years of experience in software development. He conducts online courses in ASP.NET MVC / Core, jQuery, and Design Patterns. He is a published author and has authored or co-authored books for Apress and Wrox press. Having embraced Yoga way of life he also teaches Meditation to interested individuals. To know more about him click here.

Get connected : Twitter  Facebook  Google+  LinkedIn

Posted On : 02 Feb 2003



Tags : ASP.NET Web Forms Administration