.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Code Snippets >> Network >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

To Verifies that the browser supports the required capabilities of JavaScript

Posted By:Prasanti Prusty       Posted Date: December 16, 2009    Points: 10    Category: Network    URL: http://www.dotnetspark.com  
 

To Verifies that the browser supports the required capabilities of Vb.Net

 Verifies that the browser supports the required capabilities of JavaScript.
 If Browserversion and Javscript enabled means returns True else False


Code :

    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

     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend