If you, the web designer, want to take clients back to pages that they have visited earlier, you can let the client do it by using JavaScript on the Client. (If you wish to know how to do it by that method, ask in the feedback box at the bottom of this page - tell me who you are and give an EMail address) However you may want to exercise more control over the procedure. You may want it to work for users that do not have JavaScript or VBScript on their client browser.

This page describes a way of doing it. I have chosen to describe the method using Active Server Pages - that means it runs on servers using IIS - the logic and techniques could be adapted to work with Apache or other server technologies.

The picture below describes the scenario - click here to go to the start.asp in a new window

you will see that all start.asp contains is four links - it is so simple that I will not insult your intelligence by describing it !!

I have just realised that
start.asp could be start.htm
page1.asp could be page1.htm
page2.asp could be page2.htm
page3.asp could be page3.htm
page4.asp could be page4.htm
so you can just click on Veiw -->Source to see the source of these pages - oh ain't I a fool    !!

The gobackto.asp page is fairly simple too - it is shown below.

SESSION("PAGE_TO_GO_BACK_TO") = Request.Form("pagefile")

<H1>This is the Go Back for the Go Back Demonstration</H1>
You came from <B><% =SESSION("PAGE_TO_GO_BACK_TO") %></B> and you 
will go back to it when you click on the button below
<INPUT TYPE="SUBMIT" VALUE="Press this to go BACK">

The sneakey bit is another file that is not shown on the picture dogoback.asp it is only three lines long, they are shown below

Response.Redirect SESSION("PAGE_TO_GO_BACK_TO")

Now there - aint that simple    !!

A friend of mine was having difficulty persuading one of his ECommerce sites to go back to the proper page after updating / showing the shopping basket.

I wrote this for him - but shared it with the world - it may help someone else !!

I posted a message about this page in a wonderful NewsGroup that I use. Below is an exchange that occurred as a result of that posting - thank you to Jørgen Feder

Hi Jørgen
    Sorry to have taken so long to reply, my newsreader decided that it would
not highlight your post.

    If you are going back to the page that you have just visited, there are
no advantages to my suggestion.
    It may be that you are going through several pages to make a payment
(where "several" is an indeterminate number) - in that case, only store the
page that you wish to return to, not all of the intermediate pages. I guess
that I should have described it as a "longer term memory of pages to go back

    Thank you for your question - I will modify the page.

Best Regards
Pete (Northolt UK)

"Jørgen Feder" wrote:

> On Sat, 02 Mar 2002 20:00:48 +0000, Peter Byers
> <Peter_Byers@sst-ltd.co.uk> wrote:
> >     You may be interested to know that I have just described an
> >internet technique for going back to previously visited pages - it is so
> >simple it beggars belief :-)).
> Hi Peter,
> What do you see as the advantage to using a button like this:
> <input type="submit" value="Back" name="BUTTON"
> onclick="history.back()">
> Jørgen