Hi,
in our scenario we need to ask the user for confirmation before the document browser window is closed.
In order to do so we manage the PostMessage “modified status” message and handle the beforeunload event, as per Window: beforeunload event - Web APIs | MDN
We register an handler
window.addEventListener("beforeunload", handleBeforeUnload);
function handleBeforeUnload(e) {
if(postmessage_modifiedStatus) e.preventDefault();
}
By doing so the confirmation dialog appears if I try to close the browser, but if I click “Cancel” and decide to keep the page opened and abort the browser close, something in the document breaks and it’s reloaded from scratch.
Is there a correct way to ask for confirmation before closing a Collabora page? Or is it impossible to open the beforeunload confirmation dialog with Collabora?
Thank you for any support you can provide