Forum Moderators: phranque

Message Too Old, No Replies

redirect based on previous page

redirect based on previous page

         

andrewbcd

1:03 pm on Mar 4, 2003 (gmt 0)



I am running an ecommerce site and am having a problem with my add CC pages. The problem is that i have multiple ways to get to the page and yet once the user fills in (or adds a new CC) it should take them to back to the page that they came from. So, essentially what I am searching for is a redirect based on previous page. Once the user clicks on continue from the addCCpage.asp it would take them back to the order page if they came from there, it would take them to the account info if they came from there and checkout if they came from there.

Any help on this would be appecaiated, been stuck on this for almost a week now.

ytswy

1:25 pm on Mar 4, 2003 (gmt 0)

10+ Year Member



You can do it easilly for anyone who has Javascript enabled by using document.referrer which gives the location of the last page visited, for example:

if (document.referrer == "http://www.z.com/x.htm")
{do whatever}
else if (document.referrer == "http://www.z.com/y.htm")
{do something else}

I'm sure there are better server side methods which would work for everyone, not just those who allow Javascript.