2
A
回答
2
關於瀏覽器和操作系統的信息包含在navigator
對象中。
剛剛嘗試在這兩個操作系統(WIN7和WINXP)一
window.alert(navigator.appVersion);
,並期待在不同者均基於字符串的警報彈出。 稍微解析一下這樣的字符串,你將能夠檢索到你需要的所有信息。
1
Understanding User Agent Strings
輸出你的瀏覽器的用戶代理,使用:
javascript:alert(navigator.userAgent)
這會給你的東西等的輸出:
"Windows-RSS-Platform/2.0 (MSIE 9.0; Windows NT 6.1)"
如果您解析userAgent
數據對於平臺令牌(在上例中爲Windows NT 6.1
),您將會ret甕的Windows版本。請考慮到每個瀏覽器都使用userAgent
自己的格式,並且檢測功能可能是更好的方法。
相關問題
- 1. 檢測智能卡登錄或NPLogonNotify()Windows7
- 2. 檢測在Windows XP
- 3. JavaScript代碼不能得到$在Windows7控制,但可以在XP
- 4. 問題在Windows7的Java編程(在Windows XP中運行良好)
- 5. QC10與Windows7和VAPI-XP腳本
- 6. 檢測到Windows XP在Firefox與JS
- 7. Selenium2 WebDriver無法在IE7,XP,Windows7中找到元素
- 8. Cookie未被檢測到在PHP或JavaScript
- 9. 在saucelabs中運行硒測試Windows7
- 10. 在javascript中碰撞檢測
- 11. 在javascript中檢測鏈接
- 12. 在HTML中檢測javascript
- 13. javascript檢測#在url中
- 14. 如何檢測牆紙改變時(Windows XP或更高版本)?
- 15. 檢測XP,Vista或Windows 7並根據OS
- 16. 檢測如果JavaScript在Javascript
- 17. isInIframe檢測在Javascript
- 18. 檢測Windows XP的字體渲染
- 19. 如何使用Ruby檢測Windows XP?
- 20. Jet xp,vista和Windows7中包含Jet數據庫引擎嗎?
- 21. 在Windows XP機器上運行Visual Studio 2010 Windows7項目
- 22. 在XP,Vista,Windows7 ... 32和64位上運行.Net應用程序
- 23. XP的滾動條去在Windows7/Vista的干擾
- 24. 使用C#和或ASP.NET檢測內容中的HTML或Javascript
- 25. ASP.NET單元測試Windows7/IIS7
- 26. 在CSS或JavaScript中檢測打印機的頁面大小
- 27. 如何使用CSS或Javascript在HTML中檢測WebView的大小?
- 28. 在javascript中檢測Ajax CalendarExtender的存在
- 29. Javascript window.open不專注於Windows7
- 30. 檢測的JavaScript
請問*爲什麼*? –
[jQuery - 檢測操作系統和操作系統版本]的可能重複(http://stackoverflow.com/questions/8774560/jquery-detecting-the-operating-system-and-operating-system-version) – Quentin
使用'導航器變量屬性。如'navigator.appVersion','navigator.userAgent','navigator.platform'。例如_「Windows NT 6.1; WOW64;」_是指Win7 x64(以WOW模式運行的瀏覽器)。 –