Uncle Jim's Web Designs

Restricting the Page Order
Author: Jim Stiles

Lets say you want visitors to your site to access your pages in a specific order. Maybe you want them to see your home page first. You could use a JavaScript cookie, but there's an easier way to accomplish this task. Let's say you want your visitors to see your home page (index.html) before accessing your gaming page (games.html).

Put the following function in the head of games.html:
Select Code


Then call this function using the onLoad() event handler of the BODY tag in games.html:
Select Code

The referrer property contains the URL of the document from which the user accessed games.html. So if the referrer property doesn't contain the string "index.html", the visitor bypassed your index.html page, through a bookmark on their browser. In that case, the JavaScript code loads index.html automatically.



Close This Window