To Verifies that the browser supports the required capabilities of JavaScript

Chikul
Posted by Chikul under ASP.NET category on | Views : 2634
' Verifies that the browser supports the required capabilities of JavaScript.
' If Browserversion and Javscript enabled means returns True else False


    Public Function fnDetectBrowserCapabilities() As Boolean
Try
Dim strBrowser As String = String.Empty
Dim intVersion As Int16 = 0
Dim boolFrames As Boolean = False
Dim boolTables As Boolean = False
Dim boolCookies As Boolean = False
Dim boolActiveX As Boolean = False
Dim decJavaScript As Decimal = 0.0

strBrowser = HttpContext.Current.Request.Browser.Browser
intVersion = HttpContext.Current.Request.Browser.MajorVersion
boolFrames = HttpContext.Current.Request.Browser.Frames
boolTables = HttpContext.Current.Request.Browser.Tables
boolCookies = HttpContext.Current.Request.Browser.Cookies
decJavaScript = CDec(HttpContext.Current.Request.Browser.EcmaScriptVersion.ToString)
boolActiveX = HttpContext.Current.Request.Browser.ActiveXControls

If strBrowser = "IE" AndAlso intVersion < 6 Then
Return False
ElseIf strBrowser = "Firefox" AndAlso intVersion < 2 Then
Return False
ElseIf boolFrames = False Then
Return False
ElseIf boolTables = False Then
Return False
ElseIf boolCookies = False Then
Return False
ElseIf decJavaScript < 1 Then
Return False
ElseIf strBrowser = "IE" AndAlso boolActiveX = False Then
Return False
Else
Return True
End If
Catch ex As Exception
Return False
End Try
End Function

Comments or Responses

Login to post response