The window.onbeforeunload method is used to capture browser back button events. This is helpful to warn users about losing the current data.
1 2 3 | window.onbeforeunload = function() { alert("You work will be lost"); }; |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.