views:

932

answers:

3

Can the 'Back' browser functionality be invoked from a Rails 'Back' link?

+5  A: 

Use

<%= link_to 'Back', :back %>

This is specificied in the RDoc here

This generates some Javascript to navigate backward. I've just tested it, and it works.

Tilendor
It doesn't work 'exactly' like a Back button. All the inputted form data is cleared.
alamodey
+2  A: 
link_to_function "Back", "history.back()"
Ben Alpert
A: 

You can use link_to("Hello", :back) to generate <a href="javascript:history.back()">Hello</a>.

cpm