Detect a lion (OS X 10.7) in javascript?

Is there a way to determine if OS X is Lion or not in Javascript?

Hooray!

+7
source share
2 answers

The Safari user agent (as well as 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 

It has "Mac OS X 10_7_1" - this means Lion (= Mac OS 10.7).

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

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

+4
source

http://www.quirksmode.org/js/detect.html BrowserDetect.OS However, I do not know its compatibility. <- This link uses useragent.

+2
source

All Articles