how to detect the OS version like windows NT 6.1 will give 6.1, windows NT 5.1 will give 5.1 using javascript
Asked
Active
Viewed 7,246 times
1
-
This may help: http://stackoverflow.com/questions/11219582/how-to-detect-my-browser-version-and-operating-system-using-javascript – winseybash Mar 27 '15 at 11:33
-
that is using index of with NT 6.1, but is it possible to get 6.1 without adding it to index of like get version? – Garima Garg Mar 27 '15 at 11:38
2 Answers
1
navigator.appVersion will give you Os information.And you can use it as:
document.write(navigator.appVersion);

Faisal Ijaz
- 1,812
- 2
- 12
- 23
-2
To detect the operating system on the client machine, your script can analyze the value of navigator.appVersion or navigator.userAgent. Below is a simple example of a script that sets the variable OSName to reflect the actual client OS. for example,
var OSName="Unknown OS";
if (navigator.appVersion.indexOf("Win")!=-1) OSName="Windows";
if (navigator.appVersion.indexOf("Mac")!=-1) OSName="MacOS";
if (navigator.appVersion.indexOf("X11")!=-1) OSName="UNIX";
if (navigator.appVersion.indexOf("Linux")!=-1) OSName="Linux";
document.write('Your OS: '+OSName);

ashraf
- 1
- 1
-
The question is specifically asking for the *version* not the platform. – Quentin Jun 27 '16 at 07:30