473,385 Members | 1,620 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

navigator.userAgent

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



Jul 23 '05 #1
12 3346
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
Jul 23 '05 #2
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
Jul 23 '05 #3
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
Jul 23 '05 #4
Thomas 'PointedEars' Lahn wrote:
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.


While it is 100% possible to modify/alter the userAgent string, you are
making a fundamental flaw in assuming that I do not know how to identify
a browser by other means. And the fact that you are spoofing the
userAgent string, in and of itself, gives a certain amoung of insight
into the OS and Browser.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq
Jul 23 '05 #5
Jan Buchwald wrote:
navigator.userAgent returns information about the
user operting system, Browser etc.
The navigator.userAgent property is a manifestation of the HTTP
specified User-Agent header. However, the HTTP specification makes no
requirements about the contents or format of that header (it merely
suggests that it "can" contain particular information in a particular
format) and the vast majority of browsers disregard the suggestions in
the HTTP specification entirely.
Usually you get somthing like:

Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
Yes, I have three browsers that use that one by default (only one of
them is IE 6).
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.
The user, in the sense of the user of the browsers, has little reason to
be interested in any of that information (unless they intend to
configure their browser to spoof another, assuming it doesn't already do
that by default).
What I would like to do is, evaluate the information and
reduce it to the opereting system and browser version.
That is not at all a useful thing to be doing because you can extract
the information from the string but that information does not
necessarily have any relationship with the user's operating system or
the browser type or version that they are using.

That is, the userAgent string contains what it contains and that can be
extracted, but what it contains has no certain one-to-one relationship
with individual browser type, version and OS configurations.
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.
Inevitably (as it originates with the browser), but it also may be
subject to user configuration of the browser (and OS configuration in
some cases. e.g. the dot Net stuff on Windows). But you still have the
fact that the reported information does not necessarily correspond with
the actual situation.
So a specification for each browser would be a good
starting point, any ideas where to find?
No, that would be utterly useless. The most you could know would be the
default user agent strings for each browser (and you will not find it
easy to even identify all web browsers), but even IE allows the user
complete freedom to re-configure the user agent string/header. Other
browsers offer extensive lists of user selectable user agent strings in
their preferences, all of which spoof some other browser/OS combination
more or less completely.
- Why do I get "Windows NT 5.1" instead of "Windows XP"?
Ask Microsoft.
Any other synonyms?
Potentially thousands.
I neither tested it on macs nor linux systems...
Not testing is always a good way of remaining ignorant of issues.
I would appreciate any help and hints, maybe somebody has done
something similiar before...


Probably everyone has attempted something similar at one time or
another, but the better javascript authors have recognised that the
information available is of absolutely no real use at all (because it
cannot distinguish individual browser types or versions) and abandoned
any interest in identifying browsers in favour of "feature detection".

Richard.
Jul 23 '05 #6
Randy Webb wrote:
Thomas 'PointedEars' Lahn wrote:
Nonsense. Given a suitable tool (like PrefBar), I can
fake *any* information that this host object returns.


While it is 100% possible to modify/alter the userAgent string, you are
making a fundamental flaw in assuming that I do not know how to identify
a browser by other means. [...]


It is also possible to fake information that other host objects return.
In fact, e.g., there are libraries for it available on the Net in order
to make scripts "cross-browser" (IMHO a misguided approach, but they
exist) that do exactly this. Implemented on the client-side, you would
not be able to tell what is the real object model and thus what is the
real browser. And, for example, let us assume that I noticed that clients
running on *x are somehow blocked by many Web sites which information I
nevertheless need. Given the source code of my application, which is
likely on GNU/Linux, who would be able keep me from compiling my user agent
so that it is not blocked any further? Who would be able to keep me from
distributing it then (under the GNU GPLv2, for example), for the greater
good? And, more simple, who would keep me from having client-side
scripting disabled? If you as the author restricts access to clients
with client-side scripting enabled, you would be a fool. So you would
let me in, using *any* browser (because you have nothing else than the
User-Agent header at hand *then*, and I will fake it).

Most certainly *you* are the one without enough insight in the matter here.
If you still think I am wrong, provide proof that it can be done anyway.
PointedEars
Jul 23 '05 #7
Listen guys,

I'm aware of the fact that, you can fake your IP, Browser, OP etc...stuff.
All I'm asking for, is a way of getting information of the normal user, who
has no interest of faking any kind of information about himself.

I don't care about the 1% freak people out there playing around with PrefBar
or something...


Jul 23 '05 #8
Richard Cornford wrote:
Jan Buchwald wrote:
- Why do I get "Windows NT 5.1" instead of "Windows XP"?


Ask Microsoft.


Not necessary. The Windows XP kernel is the 5.1 version of the Windows NT
kernel, as the Windows 2000 kernel is its 5.0 version (and with Win2k
clients, if not faking, will show "Windows NT 5.0"). Simple as that :)
PointedEars
Jul 23 '05 #9
Jan Buchwald wrote:
I don't care about the 1% freak people out there playing around with
PrefBar or something...


ROTFL! YMMD!
PointedEars
Jul 23 '05 #10
In article <14****************@PointedEars.de>, Po*********@web.de
enlightened us with...

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


Because the normal people who surf the net do this all the time and all.
--
--
~kaeli~
If it's tourist season, why can't we shoot them?
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #11
Thomas 'PointedEars' Lahn wrote:
Richard Cornford wrote:
Jan Buchwald wrote:
- Why do I get "Windows NT 5.1" instead of "Windows XP"?


Ask Microsoft.


Not necessary. The Windows XP kernel is the 5.1 version of the
Windows NT kernel, as the Windows 2000 kernel is its 5.0 version
(and with Win2k clients, if not faking, will show
"Windows NT 5.0"). Simple as that :)


That there is a direct relationship between the two was obvious, but why
either one was chosen to appear in the user agent header remains
unknown.

Richard.
Jul 23 '05 #12
Thomas 'PointedEars' Lahn wrote:
Randy Webb wrote:

Thomas 'PointedEars' Lahn wrote:
Nonsense. Given a suitable tool (like PrefBar), I can
fake *any* information that this host object returns.
While it is 100% possible to modify/alter the userAgent string, you are
making a fundamental flaw in assuming that I do not know how to identify
a browser by other means. [...]

It is also possible to fake information that other host objects return.
In fact, e.g., there are libraries for it available on the Net in order
to make scripts "cross-browser" (IMHO a misguided approach, but they
exist) that do exactly this. Implemented on the client-side, you would
not be able to tell what is the real object model and thus what is the
real browser. And, for example, let us assume that I noticed that clients
running on *x are somehow blocked by many Web sites which information I
nevertheless need. Given the source code of my application, which is
likely on GNU/Linux, who would be able keep me from compiling my user agent
so that it is not blocked any further? Who would be able to keep me from
distributing it then (under the GNU GPLv2, for example), for the greater
good? And, more simple, who would keep me from having client-side
scripting disabled? If you as the author restricts access to clients
with client-side scripting enabled, you would be a fool. So you would
let me in, using *any* browser (because you have nothing else than the
User-Agent header at hand *then*, and I will fake it).


Since you missed the juxt of my argument, I wont bother arguing with
your babble. Yes, its arbitrary to fake anything in a browser. I suppose
that means a browser detection script would fail in 5-10% of browsers
out. Not many people know what a userAgent string *is* much less how to
fake it. Those that know how to fake it are in a very slim minority.

So, let me rephrase what I said, in a manner you might be able to
comprehend. Ready? Read this twice so that *maybe* you can comprehend
what I say.

I *can* (in 99% of cases) identify a browser WITHOUT looking at the
userAgent string. All done with feature detection. Now, let me qualify
that 1%. If the 1% of people who know how to alter/modify the DOM of a
browser to the extent that it looks like another browser, then more
power to them. All it means is they are ignorant/stupid enough to modify
the browser to the point that a script won't run in it, just to prove
they can. Well, that 1% of the web can KMWA.
Most certainly *you* are the one without enough insight in the matter here.
If you still think I am wrong, provide proof that it can be done anyway.


I am still waiting on you to reply to my challenge of limiting a page to
NS6 and you haven't. I guess that means you admit defeat in the matter?

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq
Jul 23 '05 #13

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: ima | last post by:
Where can I find a list of valid names for Navigator.AppName?
4
by: James P. | last post by:
Hello there, I have a bound-form using Navigator so that the user can move back and forth to update record in the form. Every time a record was modified and the user clicks the Navigator to...
10
by: Jason Collins | last post by:
There are some Requests that occur that have a NULL UserAgent. Some of these are legitimate crawlers (e.g., Overture's crawler), and I'm attempting to adjust my <browserCaps> to correctly classify...
1
by: Aurelio | last post by:
Hello. How can i know what is the navigator of the client? Thanks
1
by: juglesh | last post by:
are $_SERVER in php and navigator.userAgent in js the same thing? always? I just need to determine if the browser is IE5+ on win32 (.png issues).
10
by: petermichaux | last post by:
Hi, I'm picking apart the Yahoo! UI event.js library and stripping it down to just what I need. I'm also trying to make the parts I use better. I'm stumped on how to fix the code for the...
3
by: powersakthi | last post by:
Hi All, I am using LWP::UserAgent and HTML::TreeBuilder to communicate to the below site Here is the website map: https://secure.server.com/index.htm which asks for two fields user_id...
2
by: rohitchawla | last post by:
can we get the navigator.userAgent string from actionscript just like in javascript
3
by: cketcham | last post by:
All, I have the following code: use 5.010; use LWP::UserAgent; use URI::URL; use LWP::Debug qw(+); my $browser = LWP::UserAgent->new();
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.