1

I'm using Java 6 with GWT 2.4.

I want to get client's Operating System's user friendly name using either Java Or GWT Or JavaScript.

How can I do so?

I've tried using System.getProperty("os.name"), but this gives me the machine on which my WAR is running. I want the same of client's (who is accessing my WAR) machine.

I've also tried using httpServletRequest.getHeader("User-Agent"). This gives me String like 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:21.0) Gecko/20100101 Firefox/21.0'.

Now here Windows NT 6.1 is the technical name of the client's computer's OS. As you can see here, it is mapped to two user friendly names of Windows, that are Windows 7 & Windows Server 2008 R2.

I want the direct name of OS of client's machine, either Windows 7 or Windows Server 2008 R2.

How can I achieve this?

anatol
  • 791
  • 9
  • 16
RAS
  • 8,100
  • 16
  • 64
  • 86
  • @Jeffrey, I've mentioned that I've already tried the solution given in that Post's answer. But that is also not sufficient for me. Then how can you mark it as duplicate? – RAS Aug 30 '13 at 12:10
  • Because it is essentially the same question. The other post said your best bet is to try parsing the User-Agent string. Once you figure out how to extract the technical names from the string, it should be fairly trivial to map them to user friendly names. – Jeffrey Aug 30 '13 at 12:13
  • @Jeffrey But that is my main question. parsing the User-Agent string is not the issue. Getting its actual name is the main problem. Also I've asked for an answer in GWT as well. If there's some solution in GWT, that is also acceptable. That post doesn't include GWT. So I think you should re-think on it. – RAS Aug 30 '13 at 12:26
  • I concur - duplicate. @RAS not liking an answer doesn't change the underlying issues. – Richard Sitze Aug 30 '13 at 13:35

1 Answers1

0

You probably want to use navigator.platform, which is exposed in GWT via

com.google.gwt.user.client.Window.Navigator;
fred02138
  • 3,323
  • 1
  • 14
  • 17
  • Thanks for the answer. I've tried this code. I'm using Windows 7. & the above code gives me **Win32**. – RAS Aug 30 '13 at 13:11