Feature request: dynamic content for history.back()

This would be useful for creating custom back buttons. Having this as a DC option would also make it available in the conditional logic to only display the button if there is a previous page on the site the user visited before the current page.

2 Likes

I’m pretty sure this would only work on the frontend. Input Conditions lay down some of the ground work for frontend conditions, but it’s just hard coded for form inputs to get it out the door quickly. I can make a note on this if we take frontend show conditions further.

I was curious how this would work in Cornerstone. If you add a custom attribute data-cs-back-button to a button you can get a back button working.

window.csGlobal.rivet.attach('[data-cs-back-button]', function (el) {
  el.addEventListener('click', function (e) {
    e.preventDefault();
    history.back();
  });
});
1 Like

Thanks, this works. Perhaps a conditional check on data-cs-back-button with {{element.field.custom_atts}} can work to hide the button when there is no previously visited page?

1 Like