-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcanvas.html
53 lines (53 loc) · 2.07 KB
/
canvas.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
<html>
<head>
<script type="text/javascript" src="https://wurfl.io/wurfl.js"></script>
</head>
<body>
<div><a href="test.html">DPR Test</a></div><br/>
<div><a href="windowtest.html">Window Environment Test</a></div><br/>
<div><a href="webgltest.html">Webgl Environment Test</a></div><br/>
<div><a href="navigatortest.html">Navigator Environment Test</a></div><br/>
<div id="ua"></div><br/>
<div id="wurfljs"></div><br/>
<b>Hash:</b> <div id='number'>Error on page</div><br>
<b>MimeType[4].type:</b> <div id='MimeType'></div><br>
<b>colorDepth:</b> <div id='colorDepth'></div><br>
<b>pixelDepth:</b> <div id='pixelDepth'></div><br>
<script>
function fingerprint() {
var canvas = document.createElement('canvas');
var ctx = canvas.getContext('2d');
var txt = 'i9asdm..$#po((^@KbXrww!~cz';
ctx.textBaseline = "top";
ctx.font = "16px 'Arial'";
ctx.textBaseline = "alphabetic";
ctx.rotate(.05);
ctx.fillStyle = "#f60";
ctx.fillRect(125,1,62,20);
ctx.fillStyle = "#069";
ctx.fillText(txt, 2, 15);
ctx.fillStyle = "rgba(102, 200, 0, 0.7)";
ctx.fillText(txt, 4, 17);
ctx.shadowBlur=10;
ctx.shadowColor="blue";
ctx.fillRect(-20,10,234,5);
var strng=canvas.toDataURL();
//document.body.appendChild(canvas);
var hash=0;
if (strng.length==0) return 'nothing!';
for (i = 0; i < strng.length; i++) {
char = strng.charCodeAt(i);
hash = ((hash<<5)-hash)+char;
hash = hash & hash;
}
return hash;
}
document.getElementById("ua").innerHTML = "User-Agent: " + navigator.userAgent;
document.getElementById("wurfljs").innerHTML = "Complete Device Name: " + WURFL.complete_device_name;
document.getElementById("number").innerHTML = fingerprint();
document.getElementById("MimeType").innerHTML = navigator.mimeTypes[4].type;
document.getElementById("colorDepth").innerHTML = screen.colorDepth;
document.getElementById("pixelDepth").innerHTML = screen.pixelDepth;
</script>
</body>
</html>