This page demonstrates the Random Link Generator CGI script functionality.
About This Demo: The Random Link script redirects visitors to a random URL from a configured database file. Each time you click the link, you're taken to a different randomly-selected destination.
Demo Status: The original CGI demo is no longer functional. This script requires server-side Perl CGI configuration and a configured URL database file to operate. For modern implementations, we recommend using JavaScript-based solutions that don't require server-side processing.
How It Would Work
When functional, clicking a Random Link would:
- Send a request to the Perl CGI script
- The script reads a database file containing URLs (one per line)
- A random URL is selected from the list
- The server sends an HTTP 302 redirect to that URL
- Your browser automatically follows the redirect to the destination
Example Database Format
https://example1.com/
https://example2.com/page.html
https://example3.org/
https://example4.net/path/
https://example5.com/resource
Modern JavaScript Alternative
For current websites, JavaScript provides a better solution with no server requirements:
const sites = [
'https://example1.com/',
'https://example2.com/',
'https://example3.com/'
];
function goToRandomSite() {
const url = sites[Math.floor(Math.random() * sites.length)];
window.location.href = url;
}
// Usage: <button onclick="goToRandomSite()">Random Site</button>