Did you check www.cyscape.com?
-----Original Message-----
From: Spencer W. Thomas [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 20, 2002 1:36 PM
To: JDJList
Subject: [jdjlist] Re: Browser detection on server side
Thanks, but I've already gotten that far. Maybe I need to be more
explicit. I'm looking for code that will interpret the wide variety of
user agent strings and give me back the 4 pieces of information that I want.
For example, our server (www.jstor.org), during August, has recorded
1709 distinct user agent strings from MSIE 5.5 alone (10,044 distinct
user agents total, from about 7 million web hits). The top 10 for MSIE
5.5 are (the number of times we saw each header is in the first column):
446,599 Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)
268,673 Mozilla/4.0 (compatible; MSIE 5.5; Windows 98)
191,845 Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0; T312461)
175,789 Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 4.0)
173,750 Mozilla/4.0 (compatible; MSIE 5.5; Windows 98; Win 9x 4.90)
98,468 Mozilla/4.0 (compatible; MSIE 5.5; Windows 95)
35,170 Mozilla/4.0 (compatible; MSIE 5.5; Windows 98; T312461)
32,771 Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 4.0; T312461)
24,632 Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0; H010818)
17,507 Mozilla/4.0 (compatible; MSIE 5.5; Windows 98; H010818)
These are all MSIE 5.5, that's easy. OS versions are Win2k (Windows NT
5.0), Win98, WinNT and Win95.
But then there's this case:
8,595 Mozilla/4.0 (compatible; MSIE 5.5; AOL 7.0; Windows 98; Win 9x 4.90)
7,624 Mozilla/4.0 (compatible; MSIE 6.0; AOL 7.0; Windows NT 5.1)
5,247 Mozilla/4.0 (compatible; MSIE 5.5; AOL 7.0; Windows 98)
5,233 Mozilla/4.0 (compatible; MSIE 5.0; AOL 7.0; Windows 98; DigExt)
2,670 Mozilla/4.0 (compatible; MSIE 6.0; AOL 7.0; Windows NT 5.1; Q312461)
1,504 Mozilla/4.0 (compatible; MSIE 5.5; AOL 7.0; Windows 95)
1,009 Mozilla/4.0 (compatible; MSIE 6.0; AOL 7.0; Windows 98; Win 9x 4.90)
These may look like MSIE browsers (which in a sense they are) but I want
to recognize them as AOL version 7 instead. There's a couple of WinXP
lines (WIndows NT 5.1) in this batch.
And these two look very similar, but the first one is Netscape 7 and the
second one is Mozilla 1.0rc1:
1,579 Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0rc2) Gecko/20020513
Netscape/7.0b1
1,391 Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.0rc1) Gecko/20020417
The first is running on Linux, the second on Win98.
The basic idea is simple. Correct implemention is extremely fiddly (and
is also tracking many simultaneously moving targets). That's why I'd
love it if someone else has already done it.
=S
[EMAIL PROTECTED] wrote:
>The following code should get you started... One of the headers outputted
>in this snippit is "User-Agent" so you can parse the string to get what you
>are after. I use it in a servlet for debugging purposes so out is an
>instance of java.io.PrintWriter from the code PrintWriter out =
>response.getWriter(); and response is an instance of interface
>javax.servlet.HttpServletResponse.
>
> Enumeration enum = request.getHeaderNames();
> if (enum.hasMoreElements()) {
> out.println("<H1>Request headers</H1>");
> out.println("<PRE>");
> while (enum.hasMoreElements()) {
> String strName = (String)enum.nextElement();
> out.println(" " + strName + ": " +
request.getHeader(strName));
> }
> out.println("</PRE>");
> }
>
>The output will look something like the following:
>
>Request headers
> Accept: application/vnd.ms-excel, application/msword,
application/vnd.ms-powerpoint, image/gif, image/x-xbitmap, image/jpeg,
image/pjpeg,
>application/pdf, */*
> Referer: http://localhost:7001/webiqy7001_agf.html
> Accept-Language: en-ca
> Content-Type: application/x-www-form-urlencoded
> Accept-Encoding: gzip, deflate
> User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 4.0)
> Host: localhost:7001
> Content-Length: 146
> Connection: Keep-Alive
> Cache-Control: no-cache
>
>HTH,
>Greg.
>
>
>
>
>
>"Spencer W. Thomas" <[EMAIL PROTECTED]> on 2002/08/20 11:01:12 AM
>
>Please respond to "JDJList" <[EMAIL PROTECTED]>
>
>To: "JDJList" <[EMAIL PROTECTED]>
>cc:
>
>Subject: [jdjlist] Browser detection on server side
>
>
>I'm looking for code that will reliably extract the following
>information from the USER_AGENT string, as seen by a web server:
>
>Browser type (at least MSIE, Netscape, Mozilla) and version.
>OS Platform (e.g., PC, Unix, Macintosh) and version
>(Win95/98/Me/2K/NT/XP, Mac OS9/OSX, etc.)
>
>I've got some code, it needs to be updated, and I figured "someone must
>have written this." I found this package,
>http://dhtmlkitchen.com/java/uacheck/index.jsp (Click "Download" tab for
>Java code), which is close, but doesn't give me the browser version
>(except for IE).
>
>Thanks.
>
>=Spencer
>
>
>
>To change your membership options, refer to:
>http://www.sys-con.com/java/list.cfm
>
>
>
>
>
>
>
>To change your membership options, refer to:
>http://www.sys-con.com/java/list.cfm
>
>
To change your membership options, refer to:
http://www.sys-con.com/java/list.cfm
To change your membership options, refer to:
http://www.sys-con.com/java/list.cfm