我正在使用jQuery手机开发一个移动应用程序,我想检查一下我是否在iOS5上,因为它有一些很棒的功能,比如true fixed toolbars等。
发布于 2011-12-10 23:23:54
这对我来说是有效的,只需要对用户代理进行一些字符串操作。
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');
}
}
https://stackoverflow.com/questions/8456302
复制相似问题