A while back I wanted to randomize my homepage so that when I open my web-browser (I personally like Mozilla Firefox) a different website appears. The following is what I came up with.

Step 1: Open a new page in your preferred html editor (I just used notepad or WordPad).

Screenshot Step 1

Step 2:
Copy and Paste the following code, between JavaScript tags, into your newly blank page.

var aMyLink = new Array();
var nIndex;
aMyLink.push(’http://www.yourfavoritesite1.com’);
aMyLink.push(’http://www.yourfavoritesite2.com’);
aMyLink.push(’http://www.yourfavoritesite3.com’);
nIndex = 0 + Math.floor(Math.random()*aMyLink.length);
window.location=aMyLink[nIndex];

Screenshot Step 2

Step 3:
Fill in the websites you want to load (the order doesn’t matter, because they will load randomly). You may add more than just three pages by adding more lines.

Screenshot Step 3

Step 4:
Once you have added your preferred homepages, save the file as: startup_page.htm (or whatever other name you may like better).

Screenshot Step 4

Step 5:
Open your web-browser. Go into the Options menu and find where you can set the homepage (in Mozilla Firefox this is under “Startup” in the Main Options tab). Now this is where it can get a little tricky. You need to know the file location where you have saved the startup_page.htm file (for instance mine is in the “My Documents” folder. So the file location is: C:\Documents and Settings\Owner\My Documents\startup_page.htm). The easiest way to find the directory is to right-click on the file, go to “Properties”, and copy the file location. Now just paste it into the Homepage Options. Click OK.

Screenshot Step 5

When you open your browser the next time or go to your homepage, you should get one of your random pages. If you do not, then something is wrong with your scripting and you’ll need to go back into your editor and make sure everything looks correct.

Tip: If you would like to use my random hompages you can Copy the Link Location by right-clicking Here and going to “Copy Link Location”. Then paste that into the Homepage Options. Or you can right-click and “Save Link As” to your computer and then either modify it or use it as is.

If you have any problems or it isn’t working properly, feel free to post a comment or contact us.

Share and Enjoy:
  • PickAFig
  • Digg
  • StumbleUpon
  • TwitThis
  • Facebook
  • Kirtsy
  • Blue Dot
  • Technorati
  • del.icio.us
  • NewsVine
  • LinkedIn
  • Google
  • Print this article!
  • E-mail this story to a friend!