tags:

views:

58

answers:

2

Specifically, I am trying to detect Windows XP users as they are not compatible with my software.

Is there a way to detect with at least 70% or higher accuracy?

+2  A: 
Šime Vidas
navigator.userAgent should contain this string(NT 5.1) also in Firefox.
Dr.Molle
@Dr.Molle Could you test it? Put `javascript:alert(navigator.appVersion)` in the address-bar of Firefox and press ENTER. It could be that my Firefox installation is corrupted somehow (because I'm running 3.6 and 4beta at the same time)
Šime Vidas
My Firefox returns for appVersion `5.0 (Windows; de)` . I'm using 3.6.11 on WinXP. `navigator.userAgent` returns a string containing the needed information **NT 5.1**
Dr.Molle
@Šime Vidas: FF3.6.11 on winxp pro sp3: `5.0 (Windows; en-US)`
some
Yes, same with me. It seems that `userAgent` is the correct property then
Šime Vidas
Tested with Netscape 4.79 , it returns NT 5.0 on winXP ^^
Dr.Molle
@Dr.Molle I thought WinXP is NT 5.1 http://en.wikipedia.org/wiki/Windows_NT I guess, we can just search for "NT 5" then
Šime Vidas
You're right, Netscape 4.7 is providing wrong information(NT 5.0 is win2000, I never had it). But This test was just a joke, I think we all can live with problems in NN4.7
Dr.Molle
I've tested this and this is working well! Thanks a lot :)
+1  A: 

It appears that you can use the navigator host object:

var os = navigator.platform

See here for more info: http://www.jguru.com/faq/view.jsp?EID=1100686

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

Tim Čas
`navigator` is not a class, it's an host object that exists in browsers ...
Šime Vidas
Yeah, sorry. I'll correct my post.
Tim Čas
I tried finding more information and I found this http://www.w3schools.com/jsref/prop_nav_platform.asp which is not very well-documented. Is there better documentation out there for navigator.platform? EDIT: Looks like, according to https://developer.mozilla.org/en/DOM/window.navigator.platform, you cannot detect specific OS versions within Windows
I haven't been able to find much, but here's something I did find: http://code.google.com/p/doctype/wiki/NavigatorPlatformPropertyEDIT: Firefox/Gecko reference: https://developer.mozilla.org/en/DOM/window.navigator.platform
Tim Čas
@user396449 You have to search for the MSDN (IE) and MDC (Firefox) articles: http://msdn.microsoft.com/en-us/library/ms534340(v=VS.85).aspx and https://developer.mozilla.org/en/DOM/window.navigator.platform
Šime Vidas
@user394669 Take a look at my answer. With `navigator.appVersion` you are able to detect the Windows version (NT 6.1 for Win7, etc.) in all browsers except Firefox
Šime Vidas