forked from QoreAI/DemoPages
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdevice-detect.html
More file actions
32 lines (31 loc) · 910 Bytes
/
device-detect.html
File metadata and controls
32 lines (31 loc) · 910 Bytes
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
<html>
<head>
<title>Detect Device</title>
<script async src="https://theapicompany.com/deviceAPI2.js?id=deviceAPI-tu7jprhcib"></script>
<script>
function writeData(obj) {
const ele = document.getElementById('data');
const keys = Object.keys(obj);
for(let i = 0; i < keys.length; i++) {
const key = keys[i];
const val = obj[key];
const newEle = document.createElement('div');
const content = document.createTextNode(`${key} ${val}`);
newEle.appendChild(content);
ele.appendChild(newEle);
}
}
function deviceAPIcallback (result) {
writeData(result);
let navData = {};
for (let i in navigator) {
navData[i] = navigator[i];
}
writeData(navData);
};
</script>
</head>
<body>
<div id="data"></div>
</body>
</html>