在 javascript 中检测 Lion (OS X 10.7)? [英] Detect Lion (OS X 10.7) in javascript?

查看:80
本文介绍了在 javascript 中检测 Lion (OS X 10.7)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在 Javascript 中检测操作系统是否是 OS X Lion?

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

干杯!

推荐答案

Lion 中 Safari(以及 Firefox)的用户代理类似于

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

其中包含Mac OS X 10_7_1" - 这表示 Lion (= Mac OS 10.7).

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

请参阅此处:http://www.whatsmyuseragent.com/

您可以使用navigator.userAgent"读取用户代理字符串

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

这篇关于在 javascript 中检测 Lion (OS X 10.7)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆