Usable Asp.Net

Little things that make Asp.Net more usable

Detect Vista on client machine

If you need to know if client's browser runs on a Vista machine, run javascript
navigator.userAgent
or
navigator.appVersion
and search the returning string for "Windows NT 6.0". If it is there, you are on Vista.

Posted: May 21 2007, 07:15 AM by egoldin | with 2 comment(s)
Filed under:

Comments

Ulf Gleby said:

In Firefox, navigator.appVersion does not contain the string "Windows NT 6.0". In IE it does.

Check navigator.userAgent instead. It works for both Firefox and IE.

# September 10, 2007 10:06 AM

Thomas Nordahl said:

Yup!

navigator.userAgent returns a string that looks like this in my firefox (on win xp): 'mozilla/5.0 (windows; u; windows nt 5.1; da; rv:1.8.1.8) gecko/20071008 firefox/2.0.0.8'

(navigator.userAgent.toLowerCase().indexOf("windows nt 6.0") > -1) will return true if the clients version of windows is vista.

Will the version 6.0 change if there are service pack upgrades in the future?? perhaps you should only search for 'windows nt 6', so it will work if it changes to 6.1?

# November 8, 2007 3:19 AM
Leave a Comment

(required) 

(required) 

(optional)

(required)