navigator.userAgent的 [英] navigator.userAgent

查看:41
本文介绍了navigator.userAgent的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

navigator.userAgent返回有关用户操作系统的信息,

浏览器等。


通常你会得到类似的东西:

Mozilla / 4.0(兼容; MSIE 6.0; Windows NT 5.1)



Mozilla / 4.0(兼容; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705; .NET

CLR 1.1.4322)



Mozilla / 5.0(Windows; U; Windows NT 5.1; en -US; rv:1.4)Gecko / 20030624

Netscape / 7.1(ax)


imho信息太多,大部分都让用户感到困惑。什么

我想做的是,评估信息和

将它减少到操作系统和浏览器版本。


例如


MSIE 6.0,Windows XP




Netscape 7.1,Windows 98

障碍:

- 据我所知,

navigator.userAgent返回的数据结构取决于浏览器。

所以每个浏览器的规格都是一个很好的起点,任何

想法在哪里找?

- 为什么我得到Windows NT 5.1 ;而不是Windows XP?任何其他的

同义词?


我既没有在macs也没有在linux系统上测试它...


我会感谢任何帮助和提示,也许有人做了一些事情

之前类似...


欢呼


Jan


解决方案

Jan Buchwald写道:

navigator .userAgent返回有关用户操作系统的信息,
浏览器等。




不,它没有。 < http://pointedears.de/scripts/test/whatami>

PointedEars


Thomas''PointedEars''Lahn写道:< blockquote class =post_quotes> Jan Buchwald写道:

navigator.userAgent返回有关用户操作系统的信息,
浏览器等。



不,它没有。




是的。并且没有缺陷。


如果userAgent字符串已经被修改,那么它仍然表示某些东西是
。即使它仅仅是因为

查看器使用的浏览器/操作系统允许修改userAgent

字符串。


但这与OP'的问题没什么关系*。当我读到它们时,他们想要知道如何分解userAgent字符串报告的内容,而不是如何识别浏览器/操作系统。


-

兰迪

comp.lang.javascript常见问题 - http://jibbering.com/faq


Randy Webb写道:

Thomas''PointedEars''Lahn写道:

Jan Buchwald写道:

navigator.userAgent返回有关用户操作系统的信息,
浏览器等



不,它没有。



是的。没有缺陷。




废话。给定一个合适的工具(如PrefBar),我可以这个主机对象返回的
伪* *信息。

PointedEars

navigator.userAgent returns information about the user operting system,
Browser etc.

Usually you get somthing like:

Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
or
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705; .NET
CLR 1.1.4322)
or
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624
Netscape/7.1 (ax)

imho there is too many information, most of it confusing for the user. What
I would like to do is, evaluate the information and
reduce it to the opereting system and browser version.

e.g.

MSIE 6.0, Windows XP

or

Netscape 7.1, Windows 98
obstacles:
- As far as I know, the structure of the data returned by
navigator.userAgent depends on the browser.
So a specification for each browser would be a good starting point, any
ideas where to find?
- Why do I get "Windows NT 5.1" instead of "Windows XP"? Any other
synonyms?

I neither tested it on macs nor linux systems...

I would appreciate any help and hints, maybe somebody has done something
similiar before...

cheers

Jan



解决方案

Jan Buchwald wrote:

navigator.userAgent returns information about the user operting system,
Browser etc.



No, it does not. <http://pointedears.de/scripts/test/whatami>
PointedEars


Thomas ''PointedEars'' Lahn wrote:

Jan Buchwald wrote:

navigator.userAgent returns information about the user operting system,
Browser etc.


No, it does not.



Yes it does. And without flaw.

If the userAgent string has been modified, then it is still indicative
of certain things. Even if its nothing more than the fact that the
viewer is using a browser/OS that allows the modifying of the userAgent
string.

But that has *nothing* to do with the OP''s question. As I read it, they
wanted to know how to break down what the userAgent string reports, not
how to identify a browser/OS.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq


Randy Webb wrote:

Thomas ''PointedEars'' Lahn wrote:

Jan Buchwald wrote:

navigator.userAgent returns information about the user operting system,
Browser etc.



No, it does not.



Yes it does. And without flaw.



Nonsense. Given a suitable tool (like PrefBar), I can
fake *any* information that this host object returns.
PointedEars


这篇关于navigator.userAgent的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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