How to detect Tab close in web browser and Browser Reload in Angular?
My problem is , I need to remove a key in local storage when the browser tab is closed.
I used Host Listener with 'window:beforeunload' ,
@HostListener('window:beforeunload', ['$event'])
beforeunloadHandler(event) {
// remove local storage key here
}
But , When tab is Reload it clear the key in local storage. In my problem session storage cannot be used.