I am using an beforeunload event, to notify user if he changed form without saving it, before closing the browser. I am using it in Angular
Code exmaple:
@HostListener('window:beforeunload', ['$event'])
unloadNotification($event: BeforeUnloadEvent) {
if (!this.hasFormChanged) return;
$event.returnValue();
}
It works fine on PC/laptop, but doesn't work on mobile.
However, here it says that it doesn't work on mobile: https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event
I am a little bit lost with an alternative.. Do you have any suggestions?
Thanks to everyone for help.