使用javascript确定正在使用哪个浏览器 [英] Determine what Browser being used, using javascript

查看:127
本文介绍了使用javascript确定正在使用哪个浏览器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我尝试过使用 navigator ,当然,它的确如此



我使用 alert(navigator.appName); 来确定浏览器并且我目前正在使用 Google Chrome ,当弹出窗口出现时,它显示 Mozilla ,但在 Mozilla 它可以正常工作,并且 Mozilla 它自己。



是否存在代码问题?或者它是一些错误?

解决方案

要回答你的问题,不存在任何问题或错误。 Chrome将自己表现为Mozilla。查看Chrome提供的确切用户代理字符串。



http:/ /www.useragentstring.com/pages/useragentstring.php?name=Chrome



以下是一些示例:


Chrome 20.0.1092.0



Mozilla / 5.0(Windows NT 6.1; WOW64)AppleWebKit / 536.6(KHTML,与Gecko一样) Chrome / 20.0.1092.0 Safari / 536.6



Chrome 20.0.1090.0


$ b Mozilla / 5.0(Windows NT 6.2) AppleWebKit / 536.6(KHTML,如Gecko)Chrome / 20.0.1090.0 Safari / 536.6


I have a problem in Determining Browsers.

I've tried using navigator and well, it did not help.

I used alert(navigator.appName); to determine the browser and I'm currently using Google Chrome, when the pop up appears it displayed Mozilla, but in Mozilla it works fine and with Mozilla It self.

is there a problem with the code? or it's some bug?

解决方案

To answer your question, no there is no problem or bug. Chrome represents itself as Mozilla. See this for the exact User Agent strings which Chrome gives.

http://www.useragentstring.com/pages/useragentstring.php?name=Chrome

Here are some examples:

Chrome 20.0.1092.0

Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.6 (KHTML, like Gecko) Chrome/20.0.1092.0 Safari/536.6

Chrome 20.0.1090.0

Mozilla/5.0 (Windows NT 6.2) AppleWebKit/536.6 (KHTML, like Gecko) Chrome/20.0.1090.0 Safari/536.6

这篇关于使用javascript确定正在使用哪个浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆