phpjavascriptbrowser

Detect exact OS version from browser


I was wondering if there is a way I can detect the exact Operating System version from my browser using PHP/JS/ASP?

I know I can detect the type of OS (Windows XP,Windows Vista,OS X,etc) but I need to detect the exact version: Vista Business, Vista Ultimate, Windows XP Home, Windows XP Pro, etc...


Solution

  • Short answer: You can't.

    Long answer:

    All you have is the information in the HTTP User-Agent header, which usually contains the OS name and version.

    Usually, browsers running on Mac OS and Linux send enough information to identify the exact OS. For example, here's my User-Agent header:

    Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.0.7) Gecko/2009030423 Ubuntu/8.10 (intrepid) Firefox/3.0.7

    You can see that I'm running Ubuntu 8.10 Intrepid Ibex.

    And here's what Firefox and Safari 4 Beta report on my MacBook Pro:

    Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.7) Gecko/2009021906 Firefox/3.0.7

    Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_6; en-us) AppleWebKit/528.16 (KHTML, like Gecko) Version/4.0 Safari/528.16

    Windows browsers, on the other hand, usually only report the OS version and not the specific package (Pro, Business, etc.):

    Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:x.x.x) Gecko/20041107 Firefox/x.x