-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheck-useragent.html
33 lines (28 loc) · 956 Bytes
/
check-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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Check useragent</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<script>
const userAgent = navigator.userAgent || navigator.vendor || window['opera']
let regexp
if (/android/.test(userAgent.toLowerCase())) {
regexp = /fban|fbav|instagram|snapchat|nrk|firefox|opera|klar\//
} else if (!!navigator.platform && /iPad|iPhone|iPod/.test(navigator.platform)) {
regexp = /fban|fbav|instagram|snapchat|nrk|firefox|opera|chrome|fxios|crios/
}
const issue = regexp.test(userAgent.toLowerCase())
const p = document.createElement('p')
p.innerHTML = `
<dl>
<dt>userAgent:</dt><dd> ${userAgent}</dd>
<dt>platform:</dt><dd> ${navigator.platform}</dd>
<dt>issue:</dt><dd> ${issue}</dd>
</dl>`
document.body.appendChild(p)
</script>
</body>
</html>