获取操作系统信息
var userAgent = navigator.userAgent.toLowerCase();
if (userAgent.indexOf('win') > -1) {
if (userAgent.indexOf('windows nt 5.0') > -1) {
} else if (userAgent.indexOf('windows nt 5.1') > -1 || userAgent.indexOf('windows nt 5.2') > -1) {
} else if (userAgent.indexOf('windows nt 6.0') > -1) {
} else if (userAgent.indexOf('windows nt 6.1') > -1 || userAgent.indexOf('windows 7') > -1) {
} else if (userAgent.indexOf('windows nt 6.2') > -1 || userAgent.indexOf('windows 8') > -1) {
} else if (userAgent.indexOf('windows nt 6.3') > -1) {
} else if (userAgent.indexOf('windows nt 6.2') > -1 || userAgent.indexOf('windows nt 10.0') > -1) {
if(navigator.userAgentData){
navigator.userAgentData.getHighEntropyValues(["platformVersion"]).then(ua => {
if (navigator.userAgentData.platform === "Windows") {
if (parseInt(ua.platformVersion.split('.')[0]) >= 13) {
} else if (userAgent.indexOf('iphone') > -1) {
} else if (userAgent.indexOf('mac') > -1) {
} else if (userAgent.indexOf('x11') > -1 || userAgent.indexOf('unix') > -1 || userAgent.indexOf('sunname') > -1 || userAgent.indexOf('bsd') > -1) {
} else if (userAgent.indexOf('linux') > -1) {
if (userAgent.indexOf('android') > -1) {
return { name, version };
网络状态
var ua = window.navigator.userAgent;
var con = window.navigator.connection;
var network = con.type|| con.effectiveType;
if(network != "wifi" && network != "2" && network != "unknown"){
function getNetworkType() {
var con = window.navigator.connection;
network = con.type|| con.effectiveType;
if(network == "2" || network == "unknown"){
var ua = navigator.userAgent.toLowerCase();
(s = ua.match(/rv:([\d.]+)\) like gecko/)) ? Sys.ie = s[1] :
(s = ua.match(/msie ([\d\.]+)/)) ? Sys.ie = s[1] :
(s = ua.match(/edge\/([\d\.]+)/)) ? Sys.edge = s[1] :
(s = ua.match(/edg\/([\d\.]+)/)) ? Sys.edg = s[1] :
(s = ua.match(/firefox\/([\d\.]+)/)) ? Sys.firefox = s[1] :
(s = ua.match(/(?:opera|opr).([\d\.]+)/)) ? Sys.opera = s[1] :
(s = ua.match(/chrome\/([\d\.]+)/)) ? Sys.chrome = s[1] :
(s = ua.match(/version\/([\d\.]+).*safari/)) ? Sys.safari = s[1] : 0;
if (ua.indexOf("qqbrowser") > -1) return "QQ";
if (ua.indexOf("se 2.x") > -1) return 'sogou';
if (ua.indexOf("baidubrowser") > -1) return 'baidu';
if (ua.indexOf("ucbrowser") > -1) return 'uc';
if (Sys.ie) return ('IE: ' + Sys.ie);
if (Sys.edge) return ('EDGE: ' + Sys.edge);
if (Sys.edg) return ('EDGE: ' + Sys.edg);
if (Sys.firefox) return ('Firefox: ' + Sys.firefox);
if (Sys.chrome) return ('Chrome: ' + Sys.chrome);
if (Sys.opera) return ('Opera: ' + Sys.opera);
if (Sys.safari) return ('Safari: ' + Sys.safari);
function getFlashVersion(){
if (navigator.plugins && navigator.plugins.length > 0) {
var swf = navigator.plugins["Shockwave Flash"];
var words = swf.description.split(" ");
for (var i = 0; i < words.length; ++i) {
if (isNaN(parseInt(words[i]))) continue;
flashVersion = parseInt(words[i]);