What are an alternatives to beforeunload event on mobile devices? According to the docs (https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event) beforeunload event doesn't work on mobile devices.
Our customer wants a popup message before closing the browser if user don't save the edited form.
On browsers it works fine with 'beforeunload' event.
Angular code:
@HostListener('window:beforeunload', ['$event'])
unloadNotification($event: BeforeUnloadEvent) {
if (!this.hasFormChanged) return;
$event.returnValue();
}
Thanks to everyone for your help.