This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "request.getHeader("User-Agent")" Watch "request.getHeader("User-Agent")" New topic
Author

request.getHeader("User-Agent")

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.
-Sean
Tony Alicea
Desperado
Sheriff

Joined: Jan 30, 2000
Posts: 3222
    
    5
I doubt that there's a servlet request method that returns the OS.
In JavaScript, however, there is a browser object
navigator.platform
that returns "Win32" in my case (WinNT4 SP6).
You can see what "User-Agent" your browser returns in my old page
http://www.geocities.com/~tony-alicea/detect.html

Tony Alicea
Senior Java Web Application Developer, SCPJ2, SCWCD
 
Don't get me started about those stupid light bulbs.
 
subject: request.getHeader("User-Agent")
 
Similar Threads
How to lunch browser
Determine browser and os of web user?
snap shot of web page with JavaScript
os
Do we need to supply command line search for and book flights?