Using javascript how to prevent refresh or back button event with dailog to confirm and do operation based on the user input. I have tried the below code but its not working in chrome but works on firefox.
window.onbeforeunload = function() {
return "Are you sure you wish to leave this page?";
}
During login process when multiple steps are there I wanted to prevent the user to use back button