获取本机操作系统信息
//获取系统信息 terminal_type, terminal_edition, put_system 参数的值
function agent() {
var arr = [];
var userAgentInfo = navigator.userAgent;
var Agents = ["Android", "iPhone",
"SymbianOS", "Windows Phone",
"iPad", "iPod"];
var flag = true;
for (var v = 0; v < Agents.length; v++) {
if (userAgentInfo.indexOf(Agents[v]) > 0) {
flag = false;
break;
}
}
var start = userAgentInfo.indexOf('(');
var end = userAgentInfo.indexOf(')');
var str = userAgentInfo.slice(start +1,end);
arr[0] = flag;
arr[1] = str;
return arr;
}
//result
//[true, "Windows NT 6.1; Win64; x64"]
获取更多资源关注公众号:算了个球