[thelist] best way to create "back" button

aardvark roselli at earthlink.net
Thu Jul 11 23:17:01 CDT 2002


> From: john-paul <jwalton at four09.org>
>
> what is the best way to create a "back" button on a page? Is there any
> way to do it without javascript? (ASP/PHP?)
[...]
> oh yeah... i'd rather not use a form button...

if you're gonna do it server-side, you'll need to have a block of
script that inserts the current page as variable into your links...

so, perhaps something like:

<a href="some_link.asp?backurl=<% =
Request.ServerVariables("SCRIPT_NAME") %>">a link</a>

which would render as:
<a href="some_link.asp?backurl=/url.asp">a link</a>

keep in mind, that sample script doesn't return the full URL, it's
just off the top of my head...

then all of your back buttons would need to capture that:
<a href="<% = Request("backurl") %>">back</a>

referrer is also an option, for when it comes through...

both are a hack... and doesn't work off the real browser history,
just the page that linked in...  so it won't work for pages without
the url...  you might need an if statement to hide the back link if
the variable is empty...

regardless of all this, i'd recommend against trying to replicate the
back button of the browser... i've never seen one done 100%
correctly, and when it fails, users get very confused...

--
Read the evolt.org case study
Usability: The Site Speaks for Itself
http://amazon.com/exec/obidos/ASIN/1904151035/evoltorg
ISBN: 1904151035





More information about the thelist mailing list