[ionic 4] - How to disable swipe back /go back

is there some possibility to disable swipe back (on iOS) and go back (and android) for each component/page separately?

E.G. When user log out from app, he is redirected to the login page, but now, when he goes back, he get the profile page :-/

So if swiping back is not possible to disable, is there some way to prevent this behavior?


1 Like

same problem i do have in ionic 4. ionic team has to reply for this!!!

add this bit code in your app.module.ts inorder to avoid the swipe back gesture on iphone series.

IonicModule.forRoot({ swipeBackEnabled: false })

i tried and followed this article

Thank You
Ionic docs are bit hard for beginners.

1 Like

You can archieve that with this added to router outlet:
<ion-router-outlet main [swipeGesture]="false"></ion-router-outlet>

1 Like

I haved this problem 4 months ago.
I solved it by adding [swipeGesture]="false" to the ion-router-outlet as described
here: https://github.com/ionic-team/ionic/issues/16441

  <ion-router-outlet [swipeGesture]="false"></ion-router-outlet>