View Full Version : Cookie redirect

lou smorrels
01-13-2006, 08:37 AM

Essentially what I am after is a cookie that on first visit opens page x.htm - writes a value, say 1, back to the cookie.

When the user next visits, the cookie reads the value 1 and redirects to page x2.htm and writes the value 2, next visit to x3.htm and so on to whatever value and then after say 10 different pages returns to page x.htm !

I am aware that this will not trap users that override normal cookie handling but I am prepared to miss a few users.

At the moment I am using JavaScript to randomize the pages but this is a very inelegant way of getting the job done!

Thing is I have never written a cookie :o - does anyone out there have one that will do the trick?

<body bgcolor="#C0C0C0" bottommargin="0" onload="go()" bgcolor="#C0C0C0">

var urlarray= new Array(



function go(){
var url =urlran
var target="_self"

01-13-2006, 09:54 AM
Cookies (http://www.quirksmode.org/js/cookies.html) at Quirksmode is a very good unit for this. A one page primer, if you will, with example code that will do all the hard parts for you.

lou smorrels
01-13-2006, 10:03 AM
Many thanks - I will have a look!