File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes request.getHeader( Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "request.getHeader("User-Agent")" Watch "request.getHeader("User-Agent")" New topic


Sean Casey
Ranch Hand

Joined: Dec 16, 2000
Posts: 625
I was playing around with this, and noticed that in most cases it determines the browser type as well as the operating system it's running on. Is there a way we can determine dynamically the operating system of the user? I suppose I could turn it into a string and try to find certain substrings, but I was wondering if there was a method to determine the operating system. Thanks.
Tony Alicea

Joined: Jan 30, 2000
Posts: 3226
I doubt that there's a servlet request method that returns the OS.
In JavaScript, however, there is a browser object
that returns "Win32" in my case (WinNT4 SP6).
You can see what "User-Agent" your browser returns in my old page

Tony Alicea
Senior Java Web Application Developer, SCPJ2, SCWCD
I agree. Here's the link:
subject: request.getHeader("User-Agent")
It's not a secret anymore!