-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
37 lines (37 loc) · 1.01 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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>jsdetect</title>
</head>
<body>
<script>
(function () {
// We assume we're not on Tor by default
window.onTor = false;
// Defaults
var resource = "https://secure.publeaks.nl/checktor";
var timeout = 2000; // Terminate after 2 secs.
var xhr = new XMLHttpRequest();
// See https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest
// for comprehensive documentation of the XMLHttpRequest object
xhr.open("GET", resource);
xhr.timeout = timeout;
// xhr.ontimeout = function() {
// };
xhr.onreadystatechange = function() {
if (4 == xhr.readyState && 200 == xhr.status) {
// console.log("Succesfully queried Tor status")
if (xhr.getResponseHeader("x-check-tor") === "true") {
window.onTor = true;
}
} else {
// console.log("Unsuccessfully queried Tor status")
}
// console.log(window.onTor);
};
xhr.send();
})();
</script>
</body>
</html>