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终端
var isIpad = (/iPod|iPad/i).test(u) && !isAndroid; //ipad端
var isIphone = (/iPhone/i).test(u) && !isIpad; //iPhone端
var isPc = !isAndroid && !isIOS; //PC端
网友评论