问题
Other posts refer to using XSP._isDirty() to trigger CSJS when form data has been changed and the user moves off of an XPage. Doesn't seem to be working with Domino 9.0.1 FP1. Earlier posts warned that it was a private function and may get removed.
Mastering XPages talks about using enableModifiedFlag for similar purpose (but this appears to be only for XPINC).
Any recommendations on how to warn a web browser user when they attempt to navigate away from an XPage that they will lose un-saved form data?
回答1:
You can also use CSJS to fire an alert, when the user is going to close the tab / browse another URL / close browser
Use the window.onbeforeunload
event where you can define a function which checks if the document is changed
来源:https://stackoverflow.com/questions/26370405/xsp-isdirty-and-or-enablemodifiedflag-does-not-work