Ionic Tabs Clear history after naivgation

I am navigating between tabs using the following;

After navigation I do not want the hardware back button to take me back.

Is there a way to clear history after navigating between tabs??

1 Like

Hi @almighty99 - did you ever find a solution to this?

Quick update. I found a solution. I used the ionChange event:
<ion-tabs (ionChange)="tabChanged($event)">

When this fires, the event provides the tab being navigated to. In my case I only wanted to ditch history on one of my tabs. Adding below worked well:

  if($ev.tabTitle === "TITLE_HERE"){

I handled the hardware back button using something similar


Its working perfectly Thanks

I too had the same issue. Solution is as below.

initializeApp() {
    this.platform.ready().then(() => {
      document.addEventListener("backbutton", () => {
        // code that is executed when the user pressed the back button. You can use any one of the below lines.
        // window.history.back();