How to Detect Browser Back Button event – Cross Browser

You can try popstate event handler, e.g: window.addEventListener(‘popstate’, function(event) { // The popstate event is fired each time when the current history entry changes. var r = confirm(“You pressed a Back button! Are you sure?!”); if (r == true) { // Call Back button programmatically as per user confirmation. history.back(); // Uncomment below line to … Read more

tech