Skip to content

Commit 84c51fe

Browse files
author
benja2998
committed
wiki: a
1 parent 27bbc5e commit 84c51fe

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

antibot.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// javascript proof of work to prevent headless browsers while allowing 'good scrapers' like ones that just analyze the HTML
2+
13
(function () {
24
const difficulty = 16;
35
const timeoutMs = 30000;
@@ -33,7 +35,7 @@
3335

3436
const updateTimerAndHash = async () => {
3537
const timeLeft = Math.max(0, deadline - performance.now());
36-
const currentHash = await sha256(nonce.toString()); // Wait for the hash to resolve
38+
const currentHash = await sha256(nonce.toString());
3739

3840
statusDiv.innerHTML = `
3941
Checking if you are not a robot...
@@ -61,6 +63,8 @@
6163
} else {
6264
statusDiv.textContent = "Access denied. If you are a human, please try again later.";
6365
hiddenElements.forEach(el => el.innerHTML = "");
66+
// redirect to example.com
67+
window.location.href = "https://example.com";
6468
}
6569
})();
6670
})();

0 commit comments

Comments
 (0)