I am currently working with Laravel and Vue.js to create a multi-step wizard. Within this wizard, I have implemented the onbeforeunload
event to prevent any unwanted actions by displaying a confirmation message. However, I am encountering an issue where the specific action is being executed every time, regardless of whether the user chooses to leave or stay. How can I update this behavior?
My attempted solution:
window.onbeforeunload = function(e){
//desired action here
e.returnValue = "Changes may not be saved";
}