0

I am using history.js and ajaxify.js to make my web app ajax enabled. If the user has unsaved changes on the form and they try to go to another page, I need to show them a warning that they will lose their changes if they leave.

I would normally just use window.onbeforeunload = unloadPage; but this doesn't fire with ajax page loads. How can I prevent the page from changing if they don't want to lose their unsaved edits?

TomahawkPhant
  • 1,130
  • 4
  • 15
  • 33
  • Possible duplicate: http://stackoverflow.com/questions/1299452/how-do-i-stop-a-page-from-unloading-navigating-away-in-js – DevlshOne Jul 10 '13 at 01:35
  • Not a duplicate. That question has nothing to do with ajax page loads, and as I stated, `onbeforeunload` would not work. – TomahawkPhant Jul 10 '13 at 02:50
  • Well don't you just answer at your own question by saying that it's an ajax request that is done? I mean you only need to check this before each ajax call. Just create a custom function that will call your ajax function and accepts the same parameters and use it. – Micaël Félix Sep 03 '13 at 16:16

0 Answers0