Does anyone know how to show a confirmation alert to user on go back or go forward buttons of browser clicked?
I tried to use popstate event but it does not show an alert to user. Then I added an confitmation alert on popstate event but even if the user cancel the alert it goes back. I found I can use history.forward() inside on cancel event but what it does is just refreshing the page but I do not want to refresh the page because I don’t want to lose any information. Please help.