I am creating a project using angular, In my application I need to handle back button event. Below is the code which is working fine apart from one scenario Code: this.location.subscribe(event => { //logout }); history.pushState({}, ''); This code only works when user is perform some activity, if user just landed on page and click back button then this event is not captured. I tried all the ways but not works. Continue reading...