tags:

views:

337

answers:

2

I am using

<a href="index.php" onclick="history.back();return false;">Back</a>

to provide a back to previous page link. It works fine on Windows (IE/Mozilla) but fails in Safari on both Windows/Mac.

Is there a way to make it work on all of the systems/browsers (cross-browser/platform)?

If it's not possible, is there any other way using PHP etc?

+2  A: 

it should be history.go(-1)

Robert Cabri
A: 

You should consider doing it like this instead:

<a href="javascript:history.go(-1)">Back</a>
klausbyskov
does it work on safari as well?
Yes, it works in safari.
klausbyskov
If you aren't writing a bookmarklet installer, you shouldn't be using a javascript pseudo-URI in a webpage.
David Dorward