<!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>