Hi, my requirement is upon refreshing or closing the browser tab, there should be my custom alert instead of browser alert. I have to get this work done in typescript so I am returning the $event.returnValue = false on beforeunload event which will stop my browser from closing or refreshing but at the same time I want my custom pop-up to be shown instead of browser pop-up.
` @HostListener(“window:beforeunload”, [“$event”])
beforeUnload($event: Event) {
//loading my custom pop up
$event.returnValue =false;
}
My Custom Pop-up loads but loads after I cancel the browser popup-
How can I achieve this? What am I doing wrong? Please help.