I am creating project using angular. In my project i need to handle the browser back button. The requirement is when user click on back button it should be logged out
Login Url is different and dashboard is different.
Below is the implementation
// app.component.ts
@HostListener('window:popstate', ['$event'])
onBrowserBackBtnClose(event: Event) {
history.pushState('back', null, null);
// log out url
}
But above code is not working when user just landed on the dashboard
Note: It only when user is doing some activity, if user is not doing any activity the event is not firing [chrome]