Invoke events when browser back/forward buttons are pressed

Hi all,

Is there a way to send a message handler when the user presses the browser's back or forward buttons?

I added buttons to navigate in my applications so that if the user enters data in some fields and clicks my back button, it asks the user if he is sure to leave the page without saving.

But if the user uses the back/forward buttons of the browser, it just goes back. I want to prevent it.

You can not prevent basic browser behavior.

At most you can let the browser display a pop with its default warning message about leaving the page.

This will not be the popup you made for it

1 Like