?
Solved

how to support google chrome also in my code

Posted on 2013-06-04
7
Medium Priority
?
585 Views
Last Modified: 2013-07-02
I have the below function and now I also have to add google chrome to it kindly suggest?

Private Function CheckBrowserVersion() As Boolean
            'lblLoginMSG.Text = Request.Browser.Browser.ToUpper() & " :Platform= " & Request.Browser.Platform & ":" & Request.Browser.Version
            'Return True
            '******************************************************************
            '* Support the following browsers on Windows 2000/XP platform    *
            '* IE 5.5, 6.0                                                    *      
            '* NetScape 6.0, 7.1, 7.2                                         *
            '* Mozilla Firefox 1.0                                            *
            '******************************************************************

            Try
                If Request.Browser.Platform.ToUpper = "MACPPC" Then
                    'Check for apple macintosh platform
                    If Request.Browser.Browser.ToUpper().IndexOf("IE") >= 0 Then
                        If Decimal.Parse(Request.Browser.Version) >= 5.23 Then
                            Return True
                        End If
                    ElseIf Request.Browser.Browser.ToUpper().IndexOf("NETSCAPE") >= 0 Then
                        If Decimal.Parse(Request.Browser.Version) >= 5.0 Then
                            Return True
                        End If
                    Else

                        Select Case Request.Browser.Browser.ToUpper()
                            Case "GECKO"
                                If Request.Browser.Version > 1.6 Then
                                    Return True
                                End If
                            Case Else
                                Return False
                        End Select
                    End If
                    Return False
                Else
                    'Check for windows and other
                    If Request.Browser.Browser.ToUpper().IndexOf("IE") >= 0 Then
                        If Decimal.Parse(Request.Browser.Version) >= 5.5 Then
                            Return True
                        End If
                    ElseIf Request.Browser.Browser.ToUpper().IndexOf("NETSCAPE") >= 0 Then
                        If Decimal.Parse(Request.Browser.Version) >= 5.0 Then
                            Return True
                        End If
                    ElseIf Request.Browser.Browser.ToUpper().IndexOf("FIREFOX") >= 0 Then
                        If Request.Browser.MajorVersion >= 2 Then
                            Return True
                        End If
                    Else
                        Select Case Request.Browser.Browser.ToUpper()
                            Case "GECKO"
                                If Decimal.Parse(Request.Browser.Version) > 1.6 Then
                                    Return True
                                End If
                            Case Else
                                Return False
                        End Select
                        Return False
                    End If
                End If

            Catch
                Try
                    WriteLog(Date.Now & vbCrLf & Err.Description)
                    Return False
                Catch ex1 As Exception
                    Return False
                End Try
            End Try
        End Function
0
Comment
Question by:welcome 123
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
7 Comments
 
LVL 83

Accepted Solution

by:
David Johnson, CD, MVP earned 1000 total points
ID: 39221060
Google Chrome UserAgent On a linux machine

Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.34 Safari/534.24

Chrome UserAgent on a 64 bit windows machine
Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.94 Safari/537.36

Firefox UserAgent
Mozilla/5.0 (Windows NT 6.2; WOW64; rv:21.0) Gecko/20100101 Firefox/21.0

IE 10 User Agent
Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; WOW64; Trident/6.0)
0
 

Author Comment

by:welcome 123
ID: 39235975
Frankly speaking I could not understand anything can you tell me what I need to add in my procedure above to allow google chrome?
0
 
LVL 83

Expert Comment

by:David Johnson, CD, MVP
ID: 39236026
Since you are using the user-agent to do various items I gave you some user-agents to work with.
0
 

Author Comment

by:welcome 123
ID: 39239007
The above code in a dot net code in my application and we use windows environment so in my CheckBrowserVersion method what do I need to add to allow goohgle chrome is it :

ElseIf Request.Browser.Browser.ToUpper().IndexOf("Chrome") >= 0 Then
                        If Request.Browser.MajorVersion >= 2 Then
                            Return True
                        End If
0
 
LVL 23

Assisted Solution

by:Roopesh Reddy
Roopesh Reddy earned 1000 total points
ID: 39290340
Hi,

You can try this -

Response.Write(Request.Browser.Type)
Response.Write(Request.Browser.Version)

Open in new window


Request.Browser.Type will give you the Browser name and version! I checked in .NET 4.0 and it worked for IE, Firefox and Chrome!

Hope it helps u...
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When the s#!t hits the fan, you don’t have time to look up who’s on call, draft emails, call collaborators, or send text messages. An instant chat window is definitely the way to go, especially one like HipChat. HipChat is a true business app. An…
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question