- 1
how to detect the back button being pressed on the web to return to the previous page without the button on the web
7 Respuestas
+ 6
In the callback function of keydown event, the parameter is event,
compare event.keyCode with the keycode value of keyboard backspace button.
Read:
https://developer.mozilla.org/en-US/docs/Web/API/Document/keydown_event
and
https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode
+ 3
on keydown
keyCode
+ 3
Avirur Rahman
Did you mean the backspace button on keyboard, or back button of the browser? I think you meant the latter option but please clarify this : )
+ 3
Avirur Rahman
Okay bro, thanks for clarification 👍
I asked because your question said "back button being pressed on the web to return to the previous page" 😁
+ 2
Ipang I mean the backspace button😄
+ 2
Ipang well, before returning to the previous page I want to display a message like an alert / confirm
+ 1
Gordon how to apply it give me an example