-
Notifications
You must be signed in to change notification settings - Fork 0
/
fingerprint.html
107 lines (91 loc) · 2.45 KB
/
fingerprint.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
<!doctype html>
<html>
<head>
<!-- 获取指纹 -->
<title>Fingerprint Generage</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
<style>
body{
font-family: sans-serif;
max-width: 48em;
margin: auto;
padding: 0 5%;
background: #222;
color: #fff;
}
h1 {
margin: 2em 0 0;
}
p {
font-size: 1.2em
}
button {
border: none;
color: #fff;
font-size: 1.2em;
background: #27e;
padding: 0.5em 0.75em 0.6em;
border-radius: 3px;
box-shadow: 0 3px 0 #05c;
outline: none;
}
button:active {
transform: translateY(3px);
box-shadow: none;
}
strong {
display: block;
letter-spacing: 1px;
word-wrap: break-word;
}
@media (min-width: 32em) {
h1 {
font-size: 4em;
}
strong {
font-size: 1.5em;
}
}
</style>
</head>
<body>
<div id="container"></div>
<h1>Generage Your Fingerprint </h1>
<p>Your browser fingerprint: <strong id="fp">正在获取浏览器指纹...</strong></p>
<!-- <p><code id="time"/></p> -->
<!-- <button type="button" id="btn">Get my fingerprint</button> -->
<script src="./public/js/fingerprint2.js"></script>
<script>
if (window.requestIdleCallback) {
requestIdleCallback(function () {
new Fingerprint2().get(function (components) {
console.log('get fingerprint requestIdleCallback', components) // an array of components: {key: ..., value: ...}
$("#fp").text(components);
})
})
} else {
setTimeout(function () {
new Fingerprint2().get(function (components) {
console.log('get fingerprint setTimeout', components) // an array of components: {key: ..., value: ...}
$("#fp").text(components);
})
}, 500)
}
/* $("#btn").on("click", function () {
var d1 = new Date();
var fp = new Fingerprint2();
fp.get(function(result) {
var d2 = new Date();
var timeString = "Time took to calculate the fingerprint: " + (d2 - d1) + "ms";
if(typeof window.console !== "undefined") {
console.log(timeString);
console.log(result);
}
$("#fp").text(result);
$("#time").text(timeString);
});
}); */
</script>
</body>
</html>