javascript - navigator.userAgent 没有提供完整的用户代理字符串

标签 javascript user-agent mobile-devices

目前正在获取这个值: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:21.0) Gecko/20100101 Firefox/21.0

但我已经在线测试了我当前的用户代理是: Mozilla/5.0 (Linux; U; Android 4.0.3; de-de; Galaxy S II Build/GRJ22) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30

我试过

<script>
document.write(window.navigator.userAgent);
</script>

<script>
document.write(navigator.userAgent);
</script>

它给了我 Mozilla/5.0(Windows NT 6.1;WOW64;rv:21.0)Gecko/20100101 Firefox/21.0 不是我想要的完整字符串。

它不提供有关移动设备或浏览器的任何信息。

我是否需要添加任何其他内容才能获得完整的用户代理字符串??

最佳答案

请参阅以下文档。

https://developer.mozilla.org/en-US/docs/Gecko_user_agent_string_reference

它为您提供一个包含所有信息的用户代理字符串。假设您出于某种原因正在使用 WOW64 Windows 设备。

关于javascript - navigator.userAgent 没有提供完整的用户代理字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17154847/

相关文章:

javascript - jQuery.noconflict 函数($)不工作

c# - ASP.NET 移动 View : Not detecting Firefox Mobile as Mobile

c# - 如何使用 EMDK 2.6 关闭/重启移动设备 (Win CE 6.0)?

javascript - meteor JS : How Do I Access The Javascript Console On The Mobile Device

javascript - 正则表达式 - 重复否定字符类?

javascript - 如何使用 Bootstrap 表在表头的同一行上获得四个图标?

javascript - 如何通过 Mechanize 模拟支持 JavaScript 的浏览器?

RubyMine - NoMethodError : Undefined method 'get' for nil:nilClass - Webdriver UserAgent

macos - 在 Mac OSX 上使用 WiFi 检测或发现附近的 iOS 设备或 Android 设备

javascript - Javascript 中反引号内的 if 语句