1

What is the best way to have a button mimic the "Back" browser button?

NealR
  • 10,189
  • 61
  • 159
  • 299

2 Answers2

3

Using the browser side javascript call history.back.

window.history.back()
DragonZero
  • 810
  • 5
  • 8
3

<a href="<%=Request.ServerVariables("HTTP_REFERER")%>">Back</a>

David Starkey
  • 1,840
  • 3
  • 32
  • 48
  • This has to be the best answer for a question which specifies Classic ASP :) – John Mar 26 '13 at 22:41
  • I like it better since it can be done server-side only. JS means you have to hit the client browser before going back. There are also a few issues with using JS to go back. – David Starkey Mar 26 '13 at 22:44
  • For the ones who are new to ASP: in this case REFERER is spelled incorrectly (should be referrer) but this is how it was defined. See https://stackoverflow.com/questions/3087626/was-the-misspelling-of-the-http-field-name-referer-intentional – Michiel van der Blonk Jun 21 '18 at 13:27