【发布时间】:2011-12-10 11:50:49
【问题描述】:
我正在使用 jQuery Mobile 开发一个移动应用程序,我想检查我是否在 iOS5 上,因为它有一些很棒的功能,比如true fixed toolbars 等。我正在寻找一个 JavaScript 解决方案。
【问题讨论】:
标签: ios mobile jquery-mobile
我正在使用 jQuery Mobile 开发一个移动应用程序,我想检查我是否在 iOS5 上,因为它有一些很棒的功能,比如true fixed toolbars 等。我正在寻找一个 JavaScript 解决方案。
【问题讨论】:
标签: ios mobile jquery-mobile
这适用于我对用户代理的一些字符串操作。
var ua = navigator.userAgent;
var detail = ua.split('(')[1];
var device = detail.split(';')[0];
if (device == 'iPhone' || device == 'iPod' || device == 'iPad') {
var ios = detail.split(' ')[5].split('_')[0];
if (ios == '5') {
alert('ios 5');
}
}
【讨论】: