9

How can i find what version of browser a user is using and ask him to upgrade it

asked Jun 8, 2010 at 13:14
4
  • 4
    You can use the user agent, which can be spoofed, and alert them...but it depends what you're after, why do they need to upgrade? Is there a feature they need that their current one doesn't support? In that case you should check for that feature's presence. Commented Jun 8, 2010 at 13:16
  • how can i check whether the user browser supports that feature or not. Commented Jun 8, 2010 at 13:18
  • 2
    same: That depends :) Which feature are you looking for? Flash support, opacity support, CSS3 selctors, something else? Commented Jun 8, 2010 at 13:20
  • @NickCraver in my case, I want to tell them to update from IE7. >:( They don't know that their browser is outdated, and it's not their responsibility to know because they are institutional users who are not allowed to control the software they use; but I can tell them it's outdated, so that they bother their sysadmins. :) Commented Nov 13, 2012 at 10:17

6 Answers 6

7

You can perform feature detection using jQuery, like this:

if (!jQuery.support.opacity)
 //Waah waah waah...

You can also check the browser version using jQuery, like this:

if (!jQuery.browser.msie && jQuery.browser.version === 6)
 //Waah waah waah...

However, it should be avoided where possible.

answered Jun 8, 2010 at 13:20
Sign up to request clarification or add additional context in comments.

Comments

5

You can read the HTTP_USER_AGENT from the Request.ServerVariables.

In ASP.NET that would be:

Response.Write(HttpContext.Current.Request.ServerVariables["HTTP_USER_AGENT"]);

More info here

answered Jun 8, 2010 at 13:17

Comments

2

If you are already using a javascript library like jQuery or mootools, you also have those tools at your disposal.

jQuery:

if( $.browser.msie ) {
 // do something
}

mootools:

if (Browser.Engine.trident4) {
 // ie6
}

keep in mind this is usually the wrong thing to rely on. Even the jQuery documentation has a warning that recommends feature detection instead of browser detection.

answered Jun 8, 2010 at 13:23

Comments

2

If it's only about Internet Explorer, you can use conditional comments:

<!--[if IE 6]>
Special instructions for IE 6 here
<![endif]-->

More info at http://www.quirksmode.org/css/condcom.html

answered Jun 8, 2010 at 13:27

Comments

2

On the server-side code: Request.Browser returns a HttpBrowserCapabilities instance with all the information you're looking for.

http://msdn.microsoft.com/en-us/library/system.web.httpbrowsercapabilities.aspx

On the client script side (javascript):

http://www.quirksmode.org/js/detect.html

Further to @Nick's comment, the following MSDN post:

http://msdn.microsoft.com/en-us/library/x3k2ssx2.aspx

states:

Browser capabilities indicate whether the browser type in general supports features such as JavaScript, not whether an individual instance of the browser has these features enabled or disabled.

I think version and type of the browser will tend to be fairly consistent.

answered Jun 8, 2010 at 13:19

1 Comment

Browser Abilities depends on that info being up to date, which often is not the case, not at the rate browsers advance.
0
javascript:
 alert(navigator.appVersion)
answered Jun 8, 2010 at 14:02

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.