1 function getTerminalType() { 2 //获取navigator对象 3 var o = navigator.userAgent, 4 t = ""; 5 if (/iPhone|iPad/.test(o) && !/android/i.test(o)) { 6 t = "ios"; 7 } else if (/android/i.test(o)) { 8 t = "android"; 9 } else if (/windows/i.test(o)) { 10 t = "windows"; 11 } 12 console.log(t); 13 return t; 14 }
从百度js中提取