I'd like my servlet to return content based on the
browser the user is using. I know that at least Netscape
and IE identify themselves using the "user-agent" field.
However, their syntax between them and at least between
two different versions of Netscape are very different.
For example:
Netscape 4.76:
user-agent: Mozilla/4.76 [en] (WinNT; U)
Netscape 6.0:
user-agent: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; m18) Gecko/20001108 Netscape6/6.0
IE 4.0:
user-agent: Mozilla/4.0 (compatible; MSIE 4.01; Windows NT)
So, you can see that Netscape 4.76 only identifies itself
as Mozilla, Netscape 6.0 identifies itself at the end of the
line, and IE 4.0 identifies itself in the parenthesis. Who knows
how other versions (IE 5.0, Netscape 3.1, etc.) and other
browsers identify themselves?
Does anyone have a simple class that knows all of the
peculiarities of these browsers can parse the user-agent field
correctly? Any help you can give would be very appreciated.
Gerard Monsen
1Finder.com