Hi Tim! Thanks for the incredibly quick reply! Much appreciated.
So I’ve taken your advice and i’ve added this code for the do every time workflow.
window.beforeUnloadHandler = (event) => {
event.preventDefault();
event.returnValue = true;
};
window.addEventListener("beforeunload", window.beforeUnloadHandler);
and then this code for the javascript triggered by another button:
window.removeEventListener("beforeunload", window.beforeUnloadHandler);
Unfortunately it doesn’t remove the event, but i can confirm that the warning is being shown. So the first code works, the remove one doesn’t. Attached screenshot to confirm it.
Am i missing something and doing it wrong?
Thanks a lot for the help!