javascript - Detect browser back to prevent user from losing unsaved data -


I know that I should not override the behavior of the back button, but I just want to warn the user that The form data should be saved before leaving the page.

I created this page for refresh:

  window.onbeforeunload = function () {if (myData.hasChanges ()) {return "data not saved" . }};  

But it has not been left on the back button click because my application is used for navigation. I am just updating some parts of the page using AJAX. Not returning a full post ...

How should I show the user a warning?

I want to do this: When I click on the code block and back button, a warning is shown ...


Comments

Popular posts from this blog

winforms - C# Form - Property Change -

javascript - amcharts makechart not working -

java - Algorithm negotiation fail SSH in Jenkins -