javascriptosx-lionuser-agentbrowser-detection

Detect Lion (OS X 10.7) in javascript?


Is there a way to detect if the operating system is OS X Lion or not in Javascript?


Solution

  • The user agent of Safari (and also Firefox) in Lion is something like

    Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_1) AppleWebKit/534.48.3 (KHTML, like Gecko) Version/5.1 Safari/534.48.3
    

    There is "Mac OS X 10_7_1" in it - this indicates Lion (= Mac OS 10.7).

    See here: http://www.whatsmyuseragent.com/

    You can read the user agent string using "navigator.userAgent"