J
J
Junior2020-03-08 18:30:57
JavaScript
Junior, 2020-03-08 18:30:57

How to determine which button (back or forward) was pressed in the browser?

How to determine which button (back or forward) was pressed in the browser?
Event handler:

addEventListener("popstate",function(e){
    alert('yeees!');
},false);

This method handles the back and forth button press event, but does not let you know which button was pressed.
How can I determine the pressing of the buttons back or forward separately?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question