user navigating back in Angular 11.after iis sesssion clear (app pool recycle) and press back button onPopState(() => { method firing continusly

Viewed 12

my angular version i s 11. my function is like this

constructor( private location: LocationStrategy ......){

 history.pushState(null, null, window.location.href);
    console.log(window.location);
    // check if back or forward button is pressed.
    this.location.onPopState(() => {
      
        history.pushState(null, null, window.location.href); 

      if (!window.location.href.includes('/facility')) {
        this.backButtonFunnction();
      }
    });


}

issue is when i clear the app pool(assuming that session is time out from users side) then if i press back button my application is getting stuck because of this this.location.onPopState getting called continuesly.can you please help me to fix this?

0 Answers
Related