Back Button or Link

R

Richard Cornford

FluxForums said:
<a href="" onclick="history.go(-1); return false;">Your Image or Text
Link</a>

Apart form the obvious failure to verify the existence of the history
object and its - go - method in the execution environment of this
script, a recurring (and unsolvable) problem with "back" button scripts
is that they cannot know whether there is a history to go back into. If
the page was opened in a new window or tab, accessed as a home page or
from a desktop link then there is no preceding URL and the code cannot
do anything.

The browser knows these details and greys out the back button (and
context menu entry) when there is no history. Attempting to reproduce
normal browser behaviour with a script places a considerable onus on the
script author to do as good a job as the browser would have. There is no
point re-inventing a wheel if it is going to be square.

Having realised that the control should be evidently disabled whenever
there is no history to go back into, it should also be clear that the
control should be evidently disabled or missing whenever the browser in
use does not support scripting at all.

<snip>

As you appear to have some connection with this web site, you should
maybe consider how wise it is to drop unsuspecting users of your site
(potentially clients by the look of some of the other services offered)
into Usenet newsgroups without even warning them where they are posting
to. Usenet is not something that you can take advantage of without any
consequences. The potential for generating negative publicity alone can
be considerable. If you want to see how it works go to groups.google.com
and search alt.html, alt,html.critique,
comp.infosystems.www.authoring.stylesheets and comp.lang.javascript for
"forum4designers" and see what potential troubles you are inviting.

Richard.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top