dBrippel said:
....
You can use history.go(-1), but don't use the "#" and the "onClick"
command:
<a href="javascript:history.go(-1)">go back</a>
I disagree. You only need to use "javascript:" when you are creating
bookmarklets. In all other cases, you should use onclick instead.
<URL:
http://jibbering.com/faq/#FAQ4_24 >
I don't know what the problem with Safari is, but I won't believe
that it's onclick handlers not working. Try:
<a href="..." onClick="history.go(-1);return false;">go back</a>
Now, the big question is what to write instead of "...".
I agree that "#" and "" are not good solutions (both link back to
the same page, which is not a good behavior for a link that says
"go back").
Since the href is only used if Javascript fails, you cannot use
Javascript to fill it out.
Either 1) use server side scripting to make it link to the previous
page based on the referrer header, if present, 2) make it link to
a plausible previosu page, or 3) make it link to a page that tells
the user that he needs Javascript.
A different solution is to only include the link if Javascript is
enabled, either by creating it using Javascript, or by hiding it
using CSS and unhide it using Javascript.
Anyway, I think it is a bad idea to reimplement basic browser
interface functions. There is already a back button, and it works
100% of the time.
/L