//判断是否是移动端 返回值true为移动端 false为PC端functionisDeviceMobile(){var u = navigator.userAgent
var isAndroid = u.indexOf('Android')>-1|| u.indexOf('Adr')>-1//android终端var isiOS =!!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/)//ios终端if(isiOS || isAndroid){//ios或androidreturntrue}else{//pcreturnfalse}}
//判断是android还是ios还是pc设备functionmyDeviceMobile(){var u = navigator.userAgent
var isAndroid = u.indexOf('Android')>-1|| u.indexOf('Adr')>-1//android终端var isiOS =!!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/)//ios终端if(isiOS){return1}elseif(isAndroid){return2}else{return3}}