0

How can i check whether the webpage is running in Chrome or not? if not alert the user that you are not running in chrome:

the scenario will be like this:

IF webPage is not running in Firefox then
msgbox("You are not running in chrom")
End if 

Can any one help me to do like this? am using Asp.Net with VB

  • You will have to use javascript to do that, raising message box on server makes no sense. Look at this answer http://stackoverflow.com/a/13348618/351383 – Antonio Bakula Oct 09 '14 at 09:38
  • Do you want to detect this in `webform` or `windowsform`? If `webform`, then `msgbox` , is not the write way to do. – Arindam Nayak Oct 09 '14 at 09:43

1 Answers1

1

You'll want to check the value of HttpRequest.UserAgent - the contents of this can vary wildly across browsers (here's a few examples), but in general a Chrome user agent will contain a part like Chrome/37.0.2062.124

So in your .aspx page, you could have something like this:

<% If Not HttpRequest.UserAgent.Contains("Chrome/") Then %>
  <script type="text/javascript">alert("You are not using the Chrome browser");</script>
<% End If %>

(I put the <% %> in because this doesn't go in the .aspx.vb backend page)

Psychemaster
  • 876
  • 10
  • 20