Is there a way to implement a button that has exactly the same behavior as the browser''s back button? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Try: button_to "Back", :back On Feb 16, 9:14 pm, Ralph Shnelvar <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Is there a way to implement a button that has exactly the same behavior > as the browser''s back button? > -- > Posted viahttp://www.ruby-forum.com/.-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Anthony Franco wrote:> Try: > > button_to "Back", :backIt 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. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Feb 17, 10:35 am, Ralph Shnelvar <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> 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? >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 -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
I think this would do what you''re looking for. <%= link_to ''Back'', request.headers[''HTTP_REFERER''] %> Hope this helps, On Feb 17, 6:02 am, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Feb 17, 10:35 am, Ralph Shnelvar <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: > > > 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? > > 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-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
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, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.