使用JavaScript检测Windows版本 [英] Detect Windows Version With JavaScript
问题描述
具体来说,我正在尝试检测Windows XP用户,因为它们与我的软件不兼容。
Specifically, I am trying to detect Windows XP users as they are not compatible with my software.
有没有办法检测至少70%或更高精确度?
Is there a way to detect with at least 70% or higher accuracy?
推荐答案
尝试 navigator.appVersion
http:/ /msdn.microsoft.com/en-us/library/ms533080(v=VS.85).aspx
https://developer.mozilla.org/en/DOM/window.navigator.appVersion
我这里有Windows 7, navigator.appVersion
在这些浏览器中返回包含NT 6.1的字符串:Chrome,Opera,Safari,IE9 beta。
I have Windows 7 here and the navigator.appVersion
returns a string containing "NT 6.1" in these browsers: Chrome, Opera, Safari, IE9 beta.
只有Firefox不会在该字符串中返回该信息:(
Only Firefox does not return that info in that string :(
btw,WinXP是NT 5.1 ,Vista是NT 6.0...
btw, WinXP is "NT 5.1", Vista is "NT 6.0" ...
更新
Update
navigator.userAgent
在所有5个浏览器中返回NT version字符串。这意味着 userAgent
是能够告诉Windows版本的属性。
navigator.userAgent
returns the "NT version" string in all 5 browsers. That means that userAgent
is the property that is able to tell the Windows version.
这篇关于使用JavaScript检测Windows版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!