forked from skillnull/DeviceJs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
73 lines (72 loc) · 2.77 KB
/
index.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
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Get Device Info Online</title>
<link rel="stylesheet" href="index.css?v=20200624">
</head>
<body>
<div class="title">输入以下想要获取信息的key,多个key用逗号相隔, 为空则显示全部</div>
<div class="keyTipBox">
<ul>
<li>deviceType // 设备类型</li>
<li>OS // 操作系统</li>
<li>OSVersion // 操作系统版本</li>
<li>screenHeight // 屏幕高</li>
<li>screenWidth // 屏幕宽</li>
<li>language // 当前使用的语言-国家</li>
<li>netWork // 联网类型</li>
<li>orientation // 横竖屏</li>
<li>browserInfo // 浏览器信息</li>
<li>fingerprint // 浏览器指纹</li>
<li>userAgent // 包含 appCodeName,appName,appVersion,language,platform 等</li>
<li>geoPosition // 地理位置</li>
<li>date // 系统时间</li>
<li>UUID // 通用唯一标识 Universally Unique Identifier</li>
</ul>
</div>
<div class="getInfoBox">
<textarea id="info_input" placeholder="为空默认显示全部信息"></textarea>
<button onclick="getInfo()">获取</button>
</div>
<div id="info_box"></div>
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
<script src="getDeviceInfo.js?v=20200624" type="text/javascript"></script>
<script type="text/babel">
let proxy = new Proxy({}, {
get: (target, key, receiver) => {
return Reflect.get(target, key)
},
set: (target, key, value, receiver) => {
value = value.replace(/\s+/g, "") // 去除空格
var result = Reflect.set(target, key, value, receiver)
if (result) {
DeviceInfo.getDeviceInfo({
domain: 'http://www.skillnull.com',
info: value && value.split(',')
}, (infoResult) => {
let infoHtml = []
for (let i in infoResult) {
infoHtml.push(
'<li>' +
' <span>' + i + '</span>' +
' <span style="margin:0 1px;">:</span>' +
' <span style="color: red;">' + infoResult[i] + '</span>' +
'</li>')
}
document.querySelector('#info_box').innerHTML = '<ul style="margin: 5px;">' + infoHtml.join('') + '</ul>'
})
} else {
throw new ReferenceError('something error')
}
return result
}
})
let getInfo = () => {
proxy.value = document.querySelector('#info_input').value
}
</script>
</body>
</html>