[thelist] best way to create "back" button

Mark Gallagher mark at cyberfuddle.com
Fri Jul 12 02:49:01 CDT 2002


john-paul wrote:
> what is the best way to create a "back" button on a page? Is there any way
> to do it without javascript? (ASP/PHP?)
>
> if javascript is the only way, i have found that
> <a href="#" onClick="javascript:history.back(1)">Back</a>
> and
> <a href="#" onClick="history.back(1)">Back</a>

<a href="#" onClick="history.go(-1)">Back</a>

If I were you and somehow you still wanted to use this, though, you
should probably hide it from browsers that don't understand JavaScript
(like Lynx):

<script type="text/javascript">
<!--
   document.write("<a href='#' onClick='history.go(-1)'>Back</a>");
-->
</script>

So users of such browsers aren't confronted with unusable links.


--
Mark Gallagher
http://cyberfuddle.com/infinitebabble/





More information about the thelist mailing list