0

I am currently trying to manually develop an unsaved changes warning in our JSF-based Webapplication. Sadly our customer does not like the styling of the default warning displayed via an alert() after using the onbeforeunload event and requires us to develop a similar mechanism on our own.

I was thinking of using the way described here to prevent the onbeforeunload event from displaying the alert() and simply showing my own modal panel. I just can't figure out how to make the "Yes" (yes, I want to leave this page and lose all unsaved changes) button work. The button should basically resend the request which lead to the onbeforeunload event which could have been a HTTP Request as well as an Ajax Request. How would one do that via JS?

Thank you :)

Cheers

//edit: It needs to work in IE9 as well as Chrome 38

Community
  • 1
  • 1
Michael Colin
  • 21
  • 1
  • 4
  • This might be a duplicate of http://stackoverflow.com/questions/276660/how-can-i-override-the-onbeforeunload-dialog-and-replace-it-with-my-own. – Brandon Gano Feb 20 '15 at 08:18
  • Thanks for that link. Hmmm, history.go(x); might be what I'm looking for. I'll have to give that one a try – Michael Colin Feb 20 '15 at 08:52

0 Answers0