javascript - 有没有办法用javascript检测win服务包?

标签 javascript cross-browser user-agent

我知道可以使用带有 javascript 的导航器对象检索操作系统名称,但是服务包版本呢?

有没有办法用纯js做到这一点? (没有 java 或 flash)

最佳答案

根据 http://msdn.microsoft.com/en-us/library/ms537503(v=vs.85).aspx

Alternate tokens can appear in the user-agent string for a number of reasons; usually, they identify optional features installed on your system. For example, an "SV1" token appears in the user-agent string of a user who has installed Windows XP Service Pack 2 (SP2). It is also important to note that certain non-Microsoft parties modify the user-agent string for their own purposes.

它是 SV1,因为 SP2 也是安全版本 1。所以您可以:

/sv1/i.test(navigator.userAgent)

...确定 SV1 是否包含在用户代理字符串中。我无法找到是否有任何与 SP1 关联的 token 。

关于javascript - 有没有办法用javascript检测win服务包?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6400855/

相关文章:

html - Chrome 的自动填充隐藏文本输入的背景图片

javascript - 如何使用 Instagram API 获取特定用户的帖子?

javascript - 在 Derby.js 中包含跨应用程序的样式

css - 如何为 calc 添加 webkit 支持?

css - 幻灯片在 IE 和 Div 中消失不响应 IE 中的 CSS 样式/定位

css IE6IE7/IE8 悬停问题

iphone - 如何获取 UIWebView 用户代理

ruby-on-rails - 有没有办法在 Rails 3.1 中检测用户代理

javascript - 一些 jquery 代码不工作而其他的工作正常

javascript - Typescript - 将命名空间导入另一个命名空间