Solved

how to support google chrome also in my code

Posted on 2013-06-04
7
580 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 81

Accepted Solution

by:
David Johnson, CD, MVP earned 250 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 81

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 250 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Node.js 11 77
vb.net application has warrnings about VB6 calls. 2 45
hp.myway.com malware 5 48
SSIS Column mapping 5 40
Developer portfolios can be a bit of an enigma—how do you present yourself to employers without burying them in lines of code?  A modern portfolio is more than just work samples, it’s also a statement of how you work.
Does your audience prefer people in photos or no people? How can you best highlight what you’re selling? What are your competitors doing, and what can you do that is different and unique from them?  Continue reading to learn how to make your images …
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

739 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