判断当前设备是安卓还是ios

var u = navigator.userAgent
var isAnd = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1//安卓
var ios = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/)//ios
if(isAnd)console.log('安卓')
if(ios)console.log('ios')

posted @ 2018-08-15 14:09  張先森  阅读(514)  评论(0编辑  收藏  举报