-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuseragent.html
245 lines (238 loc) · 9.84 KB
/
useragent.html
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>User_Agent!</title>
</head>
<body>
<h2>$_SERVER['HTTP_USER_AGENT']</h2>
<p>
<script type="text/javascript">
document.writeln("appCodeName : <br />" + "‍ " + "‍ " + " ⦁ " + navigator.appCodeName + "<p>");
document.writeln("appMinorVersion : <br />" + "‍ " + "‍ " + " ⦁ " + navigator.appMinorVersion + "<p>");
document.writeln("appName : <br />" + "‍ " + "‍ " + " ⦁ " + navigator.appName + "<p>");
document.writeln("appVersion : <br />" + "‍ " + "‍ " + " ⦁ " + navigator.appVersion + "<p>");
document.writeln("CookieEnabled : <br />" + "‍ " + "‍ " + " ⦁ " + navigator.cookieEnabled + "<p>");
document.writeln("CPUClass : <br />" + "‍ " + "‍ " + " ⦁ " + navigator.cpuClass + "<p>");
document.writeln("OnLine : <br />" + "‍ " + "‍ " + " ⦁ " + navigator.onLine + "<p>");
document.writeln("Platform : <br />" + "‍ " + "‍ " + " ⦁ " + navigator.platform + "<p>");
document.writeln("UserAgent : <br />" + "‍ " + "‍ " + " ⦁ " + navigator.userAgent + "<p>");
document.writeln("BrowserLanguage : <br />" + "‍ " + "‍ " + " ⦁ " + navigator.browserLanguage + "<p>");
document.writeln("SystemLanguage : <br />" + "‍ " + "‍ " + " ⦁ " + navigator.systemLanguage + "<p>");
document.writeln("UserLanguage : <br />" + "‍ " + "‍ " + " ⦁ " + navigator.userLanguage + "<p>");
</script>
<!-- <script>
(function () {
if (module.declare === undefined) {
throw 'There is no global module.declare method!';
}
//userAgent regexp
var Exp_USERAGENT = {
//browser
MSIE : /(msie) ([\w.]+)/,
MOZILLA : /(mozilla)(?:.*? rv:([\w.]+)|)/,
SAFARI : /(safari)(?:.*version|)[\/]([\d.]+)/,
CHROME : /(chrome|crios)[\/]([\w.]+)/,
OPERA : /(opera|opr)(?:.*version|)[\/]([\w.]+)/,
WEBOS : /(webos|hpwos)[\s\/]([\d.]+)/,
DOLFIN : /(dolfin)(?:.*version|)[\/]([\w.]+)/, //
SILK : /(silk)(?:.*version|)[\/]([\w.]+)/, //
UC : /(uc)browser(?:.*version|)[\/]([\w.]+)/, //
TAOBAO : /(tao|taobao)browser(?:.*version|)[\/]([\w.]+)/,
LIEBAO : /(lb)browser(?:.*? rv:([\w.]+)|)/,
//AMAYA:/(amaya)[\/]([\w.]+)/,
//SEAMONKEY:/(seamonkey)[\/]([\w.]+)/,
//OMNIWEB:/(omniweb)[\/]v([\w.]+)/,
//FLOCK:/(flock)[\/]([\w.]+)/,
//EPIPHANY:/(epiphany)[\/]([\w.]+)/,
MicroMessenger :/micromessenger/i,//
//engine
WEBKIT : /webkit[\/]([\w.]+)/,
GECKO : /gecko[\/]([\w.]+)/, //
PRESTO : /presto[\/]([\w.]+)/, //
TRIDENT : /trident[\/]([\w.]+)/,
//device
MAC : /(mac os x)\s+([\w_]+)/, //
WINNDOWS : /(windows nt)\s+([\w.]+)/, //
LINUX : /linux/, //
//IOS : /i(?:pad|phone|pod)(?:.*)cpu(?: iphone)? os/,
IOS : /(i(?:pad|phone|pod))(?:.*)cpu(?: i(?:pad|phone|pod))? os (\d+(?:[\.|_]\d+){1,})/,
ANDROID : /(android)\s+([\d.]+)/,
WINDOWSPHONE : /windowsphone/, //
IPAD : /(ipad).*os\s([\d_]+)/,
IPHONE : /(iphone\sos)\s([\d_]+)/,
IPOD : /(ipod)(?:.*)cpu(?: iphone)? os (\d+(?:[\.|_]\d+){1,})/,
TOUCHPAD : /touchpad/,
BLACKBERRY : /(playbook|blackberry|bb\d+).*version\/([\d.]+)/,
RIMTABLET : /rimtablet/, //
BADA : /bada/, //
CHROMEOS : /cromeos///
};
//define os module
module.declare('os', function (require, exports, module) {
function detect(ua) {
var os = {},
//browser
chrome = ua.match(Exp_USERAGENT.CHROME),
opera = ua.match(Exp_USERAGENT.OPERA),
msie = ua.match(Exp_USERAGENT.MSIE),
safari = (ua + ua.replace(Exp_USERAGENT.SAFARI, ' ')).match(Exp_USERAGENT.SAFARI), //modify the jquery bug
mozilla = ua.match(Exp_USERAGENT.MOZILLA),
webos = ua.match(Exp_USERAGENT.WEBOS),
dolphi = ua.match(Exp_USERAGENT.DOLFIN),
silk = ua.match(Exp_USERAGENT.SILK),
uc = ua.match(Exp_USERAGENT.UC),
taobao=ua.match(Exp_USERAGENT.TAOBAO),
liebao=ua.match(Exp_USERAGENT.LIEBAO),
//engine
webkit = ua.match(Exp_USERAGENT.WEBKIT),
gecko = ua.match(Exp_USERAGENT.GECKO),
presto = ua.match(Exp_USERAGENT.PRESTO),
trident = ua.match(Exp_USERAGENT.TRIDENT),
//device
mac = ua.match(Exp_USERAGENT.MAC),
windows = ua.match(Exp_USERAGENT.WINNDOWS),
linux = ua.match(Exp_USERAGENT.LINUX),
chromeos = ua.match(Exp_USERAGENT.CHROMEOS),
//pad
ipad = ua.match(Exp_USERAGENT.IPAD),
rimtablet = ua.match(Exp_USERAGENT.RIMTABLET),
touchpad = webos && ua.match(Exp_USERAGENT.TOUCHPAD),
//mobile
ios = ua.match(Exp_USERAGENT.IOS),
ipod = ua.match(Exp_USERAGENT.IPOD),
iphone = !ipad && ua.match(Exp_USERAGENT.IPHONE),
android = ua.match(Exp_USERAGENT.ANDROID),
windowsphone = ua.match(Exp_USERAGENT.WINDOWSPHONE),
blackberry = ua.match(Exp_USERAGENT.BLACKBERRY),
bada = ua.match(Exp_USERAGENT.BADA);
//engine
if (webkit)
os.webkit = true;
if (gecko)
os.gecko = true;
if (presto)
os.presto = true;
if (trident)
os.trident = true;
//device
os['device'] = {};
//
if (mac)
os.mac = true, os['device']['name'] = 'mac os', os.version = mac[2];
if (windows)
os.windows = true, os['device']['name'] = 'window', os.version = windows[2];
if (linux)
os.linux = true, os['device']['name'] = 'linux'; //
if (chromeos)
os.chromeos = true, os['device']['name'] = 'chromeos', os.version = chromeos[2];
//if (ios) os.ios=true;//
if (android)
os.android = true, os['device']['name'] = 'android', os.version = android[2];
if (iphone)
os.ios = true, os['device']['name'] = 'iphone',os.version = iphone[2].replace(/_/g, '.'), os.iphone = true;
if (ipod)
os.ios = true, os['device']['name'] = 'ipod',os.version = ipod[2].replace(/_/g, '.'), os.ipod = true;
if (ipad)
os.ios = true, os['device']['name'] = 'ipad', os.version = ipad[2].replace(/_/g, '.'), os.ipad = true;
if (webos)
os.webos = true, os['device']['name'] = 'webos',os.version = webos[2];
if (blackberry)
os.blackberry = true, os['device']['name'] = 'blackberry', os.version = blackberry[2];
if (bada)
os.bada = true, os['device']['name'] = 'bada',os.version = ''; //
if (rimtablet)
os.rimtablet = true, os['device']['name'] = 'rimtablet', os.version = ''; //
if (touchpad)
os.touchpad = true, os['device']['name'] = 'touchpad',os.version = ''; //
//os.device.version
os['device']['version'] = os.version;
if (!(android || iphone || ipad || ipod || webos || blackberry || bada || rimtablet || touchpad))
os.desktop = true, os.version = '';
//browser
var match = dolphi || silk || uc || msie || taobao || liebao || opera || chrome || safari || (ua.indexOf('compatible') < 0 && mozilla);
//chrome
match[1] = match[1] === 'crios' ? 'chrome' : match[1];
//taobao
match[1] = match[1] === 'tao' ? 'taobao' : match[1];
//
os[match[1]] = true;
os['browser'] = match[1];
os['version'] = match[2]||'';
//major
os['version'] && (os['major'] = parseInt(os['version'],10));
//revise
//safari
if (os.ios && os.webkit && !os.desktop) {
try{
//in node js
os.safari = (window.canSetSearchEngine || window.TrackEvent) ? true : false;
}catch(e){}
var v=os['major']||parseInt(os['device-version'],10)||'';
v && (os['ios'+v]=true);
}
//ie 11
if(os.trident && os.major >= 11){
os.browser='msie';
os.msie=true;
delete os.mozilla;
}
//mozilla/firefox
if (os.mozilla) {
os.firefox = true;
}
//opera
if(os.browser === 'opr'){
os.browser = 'opera';
os.opera=os.opr;
}
//blackberry
if(os.blackberry){
//
delete os.safari;
}
//MicroMessager
if(Exp_USERAGENT.MicroMessenger.test(ua)){
//
os.micromessage=true;
}
//uc
var DOMWindow = DOMWindow || {};
if (DOMWindow && DOMWindow.UCNewsJSController) {
os.uc = true,
os.browser = 'uc';
}
//
try{
//orientation
os.orientation = (window.orientation === 180 || window.orientation === 0) ? 'portrait' : 'landscape';
}catch(e){}
//os.device.type
if(os.desktop){
os.device['type']='desktop';
}else{
os.device['type']='mobile';
}
//
return os;
};
//navigator.userAgent.toLowerCase()
return detect(navigator.userAgent.toLowerCase());
});
})();
</script>-->
<p>
<!--[if lte IE 6]>
<p>lte ie6</p>
<![endif]-->
<!--[if lte IE 7]>
<p>lte ie7</p>
<![endif]-->
<!--[if lte IE 8]>
<p>lte ie8</p>
<![endif]-->
<!--[if lte IE 9]>
<p>lte ie9</p>
<![endif]-->
</body>
</html>