'How to change custom message in alert box

How to change custom message in alert box by using hostlistner when page refreshing in angular



Solution 1:[1]

Am trying to change a custom message to alert message I tried below code

@HostListener("window:beforeunload", 
["$event"]) 
unloadHandler(event:Event) {
let result = confirm("Changes you 
made may not be saved.");
if (result) {
}
event.returnValue = false; 
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Sushmita Nageshwar