js检查判断设备
var navigatorType = {};
var u=navigator.userAgent;
navigatorType.IsIE= u.indexOf('Trident') > -1;
navigatorType.IsOpera= u.indexOf('Presto') > -1;
navigatorType.IsWebKit= u.indexOf('AppleWebKit') > -1;
navigatorType.IsFireFox= u.indexOf('Gecko') > -1 && u.indexOf('KHTML') == -1;
navigatorType.IsMobile= !!u.match(/AppleWebKit.*Mobile.*/);
navigatorType.IsIOS= !!u.match(/(i[^;]+;( U;)? CPU.+Mac OS X/);
navigatorType.IsAndroid= u.indexOf('Android') > -1 || u.indexOf('Linux') > -1;
navigatorType.IsIPhone= u.indexOf('iPhone') > -1;
navigatorType.IsIPad= u.indexOf('iPad') > -1;
验证设备内核如图:
![](https://images2018.cnblogs.com/blog/1244681/201804/1244681-20180411134037415-1133771936.png)