javaScript判断手机型号

 1 window.onload = function () {
 2 alert("1");
 3 var u = navigator.userAgent;
 4 if (u.indexOf('Android') > -1 || u.indexOf('Linux') > -1) {//安卓手机
 5 alert("安卓手机");
 6 // window.location.href = "mobile/index.html";
 7 } else if (u.indexOf('iPhone') > -1) {//苹果手机
 8 // window.location.href = "mobile/index.html";
 9 alert("苹果手机");
10 } else if (u.indexOf('Windows Phone') > -1) {//winphone手机
11 alert("winphone手机");
12 // window.location.href = "mobile/index.html";
13 }
14 }

摘自http://www.cnblogs.com/lyl6796910/p/3700151.html

原文地址:https://www.cnblogs.com/NB-JDzhou/p/7092748.html