js判断手机是Android还是iOS

【js判断手机是Android还是iOS】var u = navigator.userAgent;
var isiOS = !!u.match(/(i[^; ]+; ( U; )? CPU.+Mac OS X/);
var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
if(isiOS){
alert('ios')
}else if(isAndroid){
alert('android')
}
OK,就这样,End~

    推荐阅读