'Back' browser action in Ruby on Rails

前端 未结 10 911
无人共我
无人共我 2020-12-23 13:24

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

10条回答
  •  有刺的猬
    2020-12-23 13:58

    Pay attention to this comment from the user rthbound! As he notes, link_to with the symbol :back does not always generate a “real” back event as if the user clicked on their browser’s Back button. It can also be a resubmit of the action that loaded the current view.

    The documentation for Rails 4.2.6 says this about link_to and the :back symbol:

    Using a :back Symbol instead of an options hash will generate a link to the referrer (a JavaScript back link will be used in place of a referrer if none exists).

提交回复
热议问题