Microsoft Edge JS userAgent检测不完整

时间:2015-09-14 15:10:25

标签: javascript windows microsoft-edge

我试图检测用户何时使用Microsoft Edge。我在VirtualBox上运行了Windows 10安装。当我使用Edge控制台中的开发人员工具检查userAgent字符串时,这就是它返回的全部内容:

  

" Mozilla / 5.0(Windows NT 10.0; Win64; x64)"

在同一Windows安装上使用Internet Explorer 11时,控制台会正确报告:

  

" Mozilla / 5.0(Windows NT 10.0; WOW64; Trident / 7.0; .NET4.0C; .NET4.0E; rv:11.0),如Gecko"

那么为什么Edge拒绝识别自己呢?有没有人遇到过这个?

2 个答案:

答案 0 :(得分:0)

It does identify itself. It should return much more info than what you posted. Are you sure you're using the latest MS Edge?

According to Microsoft documentation:

The Microsoft Edge for desktop in Windows 10 and RemoteIE builds is designed for maximum interoperability with other modern browsers and contemporary web content. It has the following user-agent string:

Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.

Notice the Edge/12.(OS build number) at the end.

答案 1 :(得分:0)

好吧,我似乎已经解决了自己的问题。我必须在Windows 10上设置一个新用户帐户。登录到新帐户后,Microsoft Edge现在可以正确报告userAgent字符串:

  

" Mozilla / 5.0(Windows NT 10.0; Win64; x64)AppleWebKit / 537.36(KHTML,与Gecko一样)Chrome / 42.0.2311.135 Safari / 537.36 Edge / 12.10240"

奇怪的问题。希望这对遇到这个问题的任何人都有帮助。