1
Surpriseplus
2022-10-14 6d536dea3cec157947947aa075bebde4305f29b9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//----------------------------------------------------------------------------------------
// 功能:检测浏览器信息 
// 赵贺  2018.06.01.
//----------------------------------------------------------------------------------------
function browerInfo() {
    var brower = {};
    var info = detectBrower();
    brower.version = transNum(info) - 0;//42
    brower.type = info.split('/')[0];//Chrome
    brower.win32 = info.indexOf("Win32") > 0 ? true : false;//32bit
    return brower;
}
function transNum(num) {
    return (num == undefined) ? 0 : parseFloat(num.match(/[\d.]+/g)[0]);
}
function isIE() {
    if (!!window.ActiveXObject || "ActiveXObject" in window) {
        return true;
    }
    return false;
}
function detectBrower() {
    var nav = window.navigator;
    var platform = nav.platform;
    var explorer = nav.userAgent;//||appVersion
    if (isIE()) {
        // var platform = nav.platform;// "Win32";
        if (window.XMLHttpRequest) {//IE7+
            return "MSIE/7.0plus" + platform;
        }
        else {//IE6, IE5
            return "MSIE/6.0" + platform;
        }
    }
    else {
        //Chrome 
        if (res = explorer.match(/Chrome\/([\d.]+)/g)) {
            return res[0] + platform;
        }
            //Firefox
        else if (res = explorer.match(/Firefox\/([\d.]+)/g)) {
            return res[0] + platform;
        }
            //Opera
        else if (res = explorer.match(/Opera\/([\d.]+)/g)) {
            return res[0] + platform;
        }
            //Safari
        else if (res = explorer.match(/Safari\/([\d.]+)/g)) {
            return res[0] + platform;
        }
            //Netscape
        else {
            return "";
        }//else
    }//else
}