利用正则表达式判断
// 判断是否 iPhone 或者 iPod
if((navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPod/i))) {
//业务代码
}else {
//业务代码
}
/**
* 判断是pc端仍是移动端,如果移动端则不显示退出登陆按钮
*/
if (/(iPhone|iPad|iPod|iOS|Android|BlackBerry|webOS)/i.test(navigator.userAgent)) {
//若是是移动端
//业务代码
}