Monday, August 18, 2014

Retrieve OS version with Javascript

Recently, I was given a task to find out what OS version an end users machine was running on.  The reason I need this information was to check if the user should be running the application on IE9 32bit or IE9 64bit.  Now, this might not sound very useful but given the environment I was working in, the end user could be having an awkword experience.

 
 <script type="text/javascript">
      function checkOSVersion() {
        if (navigator.userAgent.indexOf("WOW64") != -1 || navigator.userAgent.indexOf("Win64") != -1) 
           {
             alert("This is a 64 bit OS");
           } 
        else 
            {
                alert("Not a 64 bit OS");
            }
           }
    </script>

No comments:

Post a Comment