Why Nostr? What is Njump?
2025-04-05 20:37:16
in reply to

śatosha on Nostr: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Random Page ...

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Random Page Redirect</title>
<style>
body {
font-family: Arial, sans-serif;
text-align: center;
margin-top: 100px;
}
button {
padding: 12px 24px;
font-size: 18px;
cursor: pointer;
}
</style>
</head>
<body>
<h1>Take Me to a Random Page</h1>
<button onclick="goToRandomPage()">Go!</button>

<script>
const pages = [
"/page1.html",
"/page2.html",
"/page3.html",
// ...add up to 100 pages here
"/page100.html"
];

function goToRandomPage() {
let visited = JSON.parse(localStorage.getItem("visitedPages")) || [];

if (visited.length === pages.length) {
visited = []; // Reset if all pages have been visited
}

// Filter pages that haven't been visited yet
const remainingPages = pages.filter(p => !visited.includes(p));

// Pick a random one
const randomPage = remainingPages[Math.floor(Math.random() * remainingPages.length)];

// Save visit
visited.push(randomPage);
localStorage.setItem("visitedPages", JSON.stringify(visited));

// Redirect
window.location.href = randomPage;
}
</script>
</body>
</html>
Author Public Key
npub1ttc8j3sx59d4vs0zt23r6p90fjcd040x3vgu4j68u44ydx8u4rzqkxm0da