Forum Moderators: open
javascript:history.go(-1)
I need a S/E-readable "go back" link that not only takes the user back to the previous page, but also to the exact location on the previous page --i.e. the last view they saw before coming to the current page.
Does something like this exist?
Does something like this exist?
Not in HTML it doesn't. The only way to do something like that would be with server-side scripting writing the HTTP_REFERER into your <a> element.
Off the top of my head, it should look like this:
ASP:
<a href="<% =Request.ServerVariables("HTTP_REFERER") %>">BACK</a>
PHP:
<a href="<? echo $_SERVER['HTTP_REFERER']?>">BACK</a>
The quotes within quotes is okay here because the server-side directive will be processed before the client ever sees it.