1

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

cweiske
  • 27,869
  • 13
  • 115
  • 180
Garima Garg
  • 11
  • 1
  • 3
  • 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 Answers2

1

navigator.appVersion will give you Os information.And you can use it as:

document.write(navigator.appVersion);

Faisal Ijaz
  • 1,462
  • 2
  • 10
  • 18
-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