0

I need to detect the OS version with JS not just the OS type.

Is this possible?

Yacoby
  • 54,544
  • 15
  • 116
  • 120
Cata
  • 1
  • 7
    Do you want the browser version, or the OS version?! – Richard Fearn Jun 30 '10 at 20:10
  • 1
    I sense an X-Y problem ( http://www.perlmonks.org/index.pl?node_id=542341 ). Y is either "How do I find out the browser version with JS?" or "How do I find out the OS version with JS?" but what is X? – Quentin Jun 30 '10 at 20:12
  • @Richard: Probably the OS version, because you CAN find the OS type using Javascript via the [`Navigator.platform`](http://www.w3schools.com/jsref/prop_nav_platform.asp) property, and you can get a lot of info about the browser (including the OS type) by checking [`Navigator.userAgent`](http://www.w3schools.com/jsref/prop_nav_useragent.asp) and other `Navigator` properties. – JAB Jun 30 '10 at 20:12
  • @Cata Welcome to StackOverflow. We are here to help, but you need to take more time when asking a question and make sure everything is **clear**. Otherwise, you will just get ignored. – Josh Stodola Jun 30 '10 at 20:12
  • why oh why would you ever want to do that? – gblazex Jun 30 '10 at 20:16
  • @galambalazs: You want to display information about the user's operating system in the browser and don't want to use a language that could do it more easily? (Or don't know about/how to use one.) – JAB Jun 30 '10 at 20:19
  • OS detection already answered here: http://stackoverflow.com/questions/647969/detect-exact-os-version-from-browser – Gert Grenander Jun 30 '10 at 20:20
  • i'd stick with the idea, that for javascript, browser is the os – mykhal Jun 30 '10 at 22:25

1 Answers1

2

My navigator.userAgent in Firefox shows :

"Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6"

In chrome:

"Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/533.4 (KHTML, like Gecko) Chrome/5.0.375.86 Safari/533.4"

In IE8:

"Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.04506.6

So apparently for my particular OS/Browsers combination is possible, but I would not really count on that working everywhere.

Francisco Soto
  • 10,277
  • 2
  • 37
  • 46