-3

I have the following scenario on my website.. When a user is on the payment(checkout) page and hits the back button, an error page is displayed by default (magento tricky stuff).

I would like my user to be redirected on the homepage!

Is this possible using javascript/jquery, or using html5 push state?

Any help would much be appreciated.

Dimag Kharab
  • 4,439
  • 1
  • 24
  • 45
wasiim_dev
  • 1,057
  • 1
  • 9
  • 22

1 Answers1

-1

Try this for back: history.back(-1);

This is a back button I made:

document.getElementById('exit').addEventListener('click', function(event) {
    event.preventDefault();
    history.back(-1);
});

<button id="exit"></button>
zer00ne
  • 41,936
  • 6
  • 41
  • 68