Homepage Randomizer
February 8, 2006 1:47 PM   Subscribe

Im looking for a program/extension that will allow me to set 4 or 5 different homepages. I would like to rotate them randomly so my homepage is always a surpirse. Any ideas?
posted by Cookie Monster to Technology (17 answers total)
 
i would set the homepage to a local HTML page and use some Javascript to randomly redirect to a list of pages
posted by BSummers at 1:53 PM on February 8, 2006


I like BSummers' idea, but I'd put it on a web server instead of on my local HD. That way I could have the same settings on multiple computers without having to copy a file each time.
posted by scottj at 2:08 PM on February 8, 2006


i was going for simplicity and ease of use but if you use multiple computers and have a webserver definately go that route
posted by BSummers at 2:10 PM on February 8, 2006


I could code up a quick tool and serve it on my server, allowing individual users to have a list of pages to randomly choose between, if you really want. You'd set your homepage to the tool on my server, and it would pick a page for you randomly out of your list, which you could edit at will.
posted by twiggy at 2:11 PM on February 8, 2006


That's an excellent idea, I will probably use this myself:


<html>
<head>
<title>Redirecting to random homepage...</title>
</head>
<body>
<script>
var randomHomepage=new Array()

randomHomepage[0]="http://www.google.com";
randomHomepage[1]="http://ask.metafilter.com";
randomHomepage[2]="http://www.metafilter.com";
randomHomepage[3]="http://projects.metafilter.com";
randomHomepage[4]="http://metatalk.metafilter.com";

window.location=randomHomepage[Math.floor(Math.random()*randomHomepage.length)]
</script>
</body>
</html>



Extend as you see fit. On a related note, if you have firefox, you can have multiple homepages.
posted by charmston at 2:12 PM on February 8, 2006


Downside to the redirect solution is that people will link directly to one of the designs. A simple Perl or PHP script would pick a random html file, load it in and then display it.

No redirects, no chance of bookmarking one of your alternative pages.

If you want me to knock it up for you (takes 10 minutes) let me know on here.
posted by mr_silver at 2:25 PM on February 8, 2006


IIRC, this is one of the things covered in ORA's HTML book in the server side includes section, but I don't have my copy here.
posted by boo_radley at 2:27 PM on February 8, 2006


Couldn't you make one of those bookmarklet things (ie. URL starting with 'javascript:') to pick a random page from 4/5, and then set that as the homepage?
posted by reklaw at 2:32 PM on February 8, 2006


Yep, reklaw and charmston have a couple of great ideas. Set your homepage to this:

javascript:var randomHomepage=new Array(); randomHomepage[0]="http://www.google.com"; randomHomepage[1]="http://ask.metafilter.com"; randomHomepage[2]="http://www.metafilter.com"; randomHomepage[3]="http://projects.metafilter.com"; randomHomepage[4]="http://metatalk.metafilter.com"; window.location=randomHomepage[Math.floor(Math.random()*randomHomepage.length)]

Changing the URLs as you see fit. Make sure all of that is on one line, and you should be happy.
posted by ducksauce at 3:00 PM on February 8, 2006


Here is charmston's script as a bookmarklet; it works great for me as the home page in Firefox.

javascript:var r=new Array();r[0]="http://www.google.com"; r[1]="http://ask.metafilter.com"; r[2]="http://www.metafilter.com"; r[3]="http://projects.metafilter.com"; r[4]="http://metatalk.metafilter.com"; window.location=r[Math.floor(Math.random()*r.length)];
posted by SpookyFish at 3:03 PM on February 8, 2006


Doh! Bad self, use preview!
posted by SpookyFish at 3:04 PM on February 8, 2006


Using a server-side script is preferable to using JavaScript for the reason mr_silver pointed out, plus the JS redirect is awkward from the user perspective since they go to two different URLs, and it tends to break the Back button.

If you can use PHP on your server, just put this in your index.php page:

<?php
$i = mt_rand(1, 5);
include("/path/to/homepages/homepage_$i.html");
?>


Then make your pages homepage_1.html through homepage_5.html, put them in the right directory, and you're set.
posted by staggernation at 3:23 PM on February 8, 2006


Oh, wait. Totally missed what you wanted to do, there. Sorry.
posted by staggernation at 3:23 PM on February 8, 2006


Just to clarify, there are obviously two sense of the word "homepage" being used here.

1 -- "the page I see when I start up my browser"

2 -- "the front page of my website".

It's not immediately clear which one you want.
posted by AmbroseChapel at 7:05 PM on February 8, 2006


Also, what's all this

new Array(), array[0]='foo', array[1]='bar'

for?

javascript:r=new Array(
"http://www.google.com",
"http://ask.metafilter.com",
"http://www.metafilter.com",
"http://projects.metafilter.com",
"http://metatalk.metafilter.com");
window.location=r[parseInt(Math.random()*r.length)];


does the same thing.

What are they teaching in JavaScript school these days...
posted by AmbroseChapel at 7:07 PM on February 8, 2006


Not what you're looking for, but just as an FYI, the venerable Yahoo Randomizer still works. Perhaps best not used at work, though these days it's pretty heavy on obscure small businesses and domain squatters.
posted by dhartung at 9:51 PM on February 8, 2006


Missed your intent; I thought you were talking about setting up a randomizer for a web site you owned. Mea culpa.
posted by boo_radley at 7:10 AM on February 9, 2006


« Older Can you help set up our wifi?   |   Looking for reputable flower merchant. Newer »
This thread is closed to new comments.