~jstys-z/helioviewer.org/client5

« back to all changes in this revision

Viewing changes to help/browser.html

  • Committer: V. Keith Hughitt
  • Date: 2009-04-01 21:08:05 UTC
  • Revision ID: hughitt1@kore-20090401210805-372f7dgih07vxk42
nightly build 04-01-2009

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<!DOCTYPE html>
2
 
<html lang='en'>
3
 
<head>
4
 
    <!-- Page to help diagnose issues encountered by remote users -->
5
 
    <title>Helioviewer.org - Browser Diagnostics</title>
6
 
    <meta charset="utf-8" />
7
 
    <script type='text/javascript' src='http://code.jquery.com/jquery.min.js'></script>
8
 
    <script type='text/javascript'>
9
 
        // http://www.quirksmode.org/js/detect.html
10
 
        var BrowserDetect = {
11
 
                init: function () {
12
 
                        this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
13
 
                        this.version = this.searchVersion(navigator.userAgent)
14
 
                                || this.searchVersion(navigator.appVersion)
15
 
                                || "an unknown version";
16
 
                        this.OS = this.searchString(this.dataOS) || "an unknown OS";
17
 
                },
18
 
                searchString: function (data) {
19
 
                        for (var i=0;i<data.length;i++) {
20
 
                                var dataString = data[i].string;
21
 
                                var dataProp = data[i].prop;
22
 
                                this.versionSearchString = data[i].versionSearch || data[i].identity;
23
 
                                if (dataString) {
24
 
                                        if (dataString.indexOf(data[i].subString) != -1)
25
 
                                                return data[i].identity;
26
 
                                }
27
 
                                else if (dataProp)
28
 
                                        return data[i].identity;
29
 
                        }
30
 
                },
31
 
                searchVersion: function (dataString) {
32
 
                        var index = dataString.indexOf(this.versionSearchString);
33
 
                        if (index == -1) return;
34
 
                        return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
35
 
                },
36
 
                dataBrowser: [
37
 
                        {
38
 
                                string: navigator.userAgent,
39
 
                                subString: "Chrome",
40
 
                                identity: "Chrome"
41
 
                        },
42
 
                        {       string: navigator.userAgent,
43
 
                                subString: "OmniWeb",
44
 
                                versionSearch: "OmniWeb/",
45
 
                                identity: "OmniWeb"
46
 
                        },
47
 
                        {
48
 
                                string: navigator.vendor,
49
 
                                subString: "Apple",
50
 
                                identity: "Safari",
51
 
                                versionSearch: "Version"
52
 
                        },
53
 
                        {
54
 
                                prop: window.opera,
55
 
                                identity: "Opera",
56
 
                                versionSearch: "Version"
57
 
                        },
58
 
                        {
59
 
                                string: navigator.vendor,
60
 
                                subString: "iCab",
61
 
                                identity: "iCab"
62
 
                        },
63
 
                        {
64
 
                                string: navigator.vendor,
65
 
                                subString: "KDE",
66
 
                                identity: "Konqueror"
67
 
                        },
68
 
                        {
69
 
                                string: navigator.userAgent,
70
 
                                subString: "Firefox",
71
 
                                identity: "Firefox"
72
 
                        },
73
 
                        {
74
 
                                string: navigator.vendor,
75
 
                                subString: "Camino",
76
 
                                identity: "Camino"
77
 
                        },
78
 
                        {               // for newer Netscapes (6+)
79
 
                                string: navigator.userAgent,
80
 
                                subString: "Netscape",
81
 
                                identity: "Netscape"
82
 
                        },
83
 
                        {
84
 
                                string: navigator.userAgent,
85
 
                                subString: "MSIE",
86
 
                                identity: "Explorer",
87
 
                                versionSearch: "MSIE"
88
 
                        },
89
 
                        {
90
 
                                string: navigator.userAgent,
91
 
                                subString: "Gecko",
92
 
                                identity: "Mozilla",
93
 
                                versionSearch: "rv"
94
 
                        },
95
 
                        {               // for older Netscapes (4-)
96
 
                                string: navigator.userAgent,
97
 
                                subString: "Mozilla",
98
 
                                identity: "Netscape",
99
 
                                versionSearch: "Mozilla"
100
 
                        }
101
 
                ],
102
 
                dataOS : [
103
 
                        {
104
 
                                string: navigator.platform,
105
 
                                subString: "Win",
106
 
                                identity: "Windows"
107
 
                        },
108
 
                        {
109
 
                                string: navigator.platform,
110
 
                                subString: "Mac",
111
 
                                identity: "Mac"
112
 
                        },
113
 
                        {
114
 
                                   string: navigator.userAgent,
115
 
                                   subString: "iPhone",
116
 
                                   identity: "iPhone/iPod"
117
 
                    },
118
 
                        {
119
 
                                string: navigator.platform,
120
 
                                subString: "Linux",
121
 
                                identity: "Linux"
122
 
                        }
123
 
                ]
124
 
 
125
 
        };
126
 
        
127
 
        
128
 
        // Main
129
 
        $(function () {
130
 
            BrowserDetect.init();
131
 
            $("#date").html(new Date().toString());
132
 
            $("#os").html(BrowserDetect.OS);
133
 
            $("#browser").html(BrowserDetect.browser + ' ' + BrowserDetect.version);
134
 
            
135
 
            // localStorage/cookies
136
 
            if (('localStorage' in window) && window['localStorage'] !== null) {
137
 
                $("#settings").html(localStorage.settings);
138
 
            } else {
139
 
                $("#settings").html(document.cookie);
140
 
            }
141
 
            
142
 
        });
143
 
    </script>
144
 
</head>
145
 
<body>
146
 
    <div style='text-align:center;'>
147
 
        <h1>Browser diagnostics</h1>
148
 
        <span style='font-size:11px' id='date'></span>
149
 
        <div style='margin: 50px auto; text-align: left; width: 60%;'>
150
 
            <b>OS:</b> <span id='os'></span><br />
151
 
            <b>Browser:</b> <span id='browser'></span><br />
152
 
            <b>Settings: </b><br />
153
 
            <div id='settings' style='border: 1px solid gray; padding: 5px; font-size: 11px; overflow-x: auto;'></div>
154
 
        </div>
155
 
    </div>
156
 
</body>
157
 
</html>