Posted By

merrittwjm on 05/07/11


Tagged

javascript js detection version os


Versions (?)

OS Detection


 / Published in: JavaScript
 

  1. //OS DETECTION...
  2. var OSName="Unknown OS";
  3. if (navigator.appVersion.indexOf("Win")!=-1) OSName="Windows";
  4. if (navigator.appVersion.indexOf("Mac")!=-1) OSName="MacOS";
  5. if (navigator.appVersion.indexOf("X11")!=-1) OSName="UNIX";
  6. if (navigator.appVersion.indexOf("Linux")!=-1) OSName="Linux";
  7.  
  8. var OSVer="Unknown Ver";
  9. if (navigator.appVersion.indexOf("NT 5.1")!=-1) OSVer="XP";
  10. if (navigator.appVersion.indexOf("NT 6.0")!=-1) OSVer="Vista";
  11. if (navigator.appVersion.indexOf("NT 6.1")!=-1) OSVer="7";
  12. if (navigator.userAgent.indexOf("Mac OS X 10.4")!=-1) OSVer="Tiger";
  13. if (navigator.userAgent.indexOf("Mac OS X 10.5")!=-1) OSVer="Leopard";
  14. if (navigator.userAgent.indexOf("Mac OS X 10.6")!=-1) OSVer="Snow Leopard";

Report this snippet  

You need to login to post a comment.