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

Hello,
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?

Thanks

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
https://www.damirscorner.com/blog/posts/20190823-SwipebackGestureConfigurationInIonic4.html

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-app>
  <ion-router-outlet [swipeGesture]="false"></ion-router-outlet>
</ion-app>
2 Likes