Is there a way to implement a button that has exactly the same behavior
as the browser's back button?
Try:
button_to "Back", :back
Anthony Franco wrote:
Try:
button_to "Back", :back
It does not have the same behavior.
If I understand the documentation, :back uses the referrer field.
Does Rails maintain a "per window" or "per tab" linked list of URLs?
visited?
I think this may be a bit more complicated than just using :back.
But thanks for the answer.
Nope. (although I suppose you maintain such a list by collecting the
referrer on each page view).
If javascript is an option then history.go(-1) takes you one back.
What's wrong with the browser's back button ?
Fred
I think this would do what you're looking for.
<%= link_to 'Back', request.headers['HTTP_REFERER'] %>
Hope this helps,
Ralph Shnelvar wrote:
Is there a way to implement a button that has exactly the same behavior
as the browser's back button?
You can do this with JavaScript -- check out history.go() -- but there's
generally no point in doing so. The Back button is always available in
every browser I'm familiar with, and users expect to use it.
Best,