[pmwiki-users] history.back ?

Joachim Durchholz jo at durchholz.org
Tue Mar 28 02:56:13 CST 2006

Thomas Lederer schrieb:
> But i would like to offer more than "If you want to go back, please use
> the back button of your browser" on my 404 Page ;)


> If that is the best method, without breaking standards, then yes please ;)

Make the Back button invisible (there's a CSS style for that), and have 
the JS unhide it after it's loaded. That way, you don't irritate people 
who don't have JS.

A solution that doesn't need JS at all would be to place a link that 
refers to whatever is in $_SERVER['HTTP_REFERER'].

Should look something like

     \'<a href="\'
     . htmlentities($_SERVER[\'HTTP_REFERER\'], ENT_QUOTES)
     . \'" >Back</a>\'

Changes wrt. Hans' proposal:
* Uses an ordinary link instead of JS. (Also makes this Apache-specific.)
* Uses htmlentities() to prevent mishaps if the referrer URL happens to 
contain a quote character.
* Uses Keep() to prevent PmWiki from trying to find markup inside the URL.

Warning: the above code is untested.


More information about the pmwiki-users mailing list