Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove page from history, so "back" will work properly

Tags:

I have my app that you need to login to get in to the other pages.

so the first page is "login" and it checks if you are already logged, if so you will be redirected to the main page app, if not it will show you the login page.

now the problem is when the user is inside the logged page area, and he clicks back he will get to the "login" page and than redirected back to the main page, as he is logged in already.

So he is stuck in an infinite loop.

how can I remove the login page from the history.

just like in android "android remove activity from history stack"

like image 605
Tzook Bar Noy Avatar asked Oct 18 '14 15:10

Tzook Bar Noy


People also ask

Can browsing history be recovered once it is deleted?

The easiest method is to do a system restore. If the internet history was deleted recently, then system restore will recover it. To get system restore up and running you can go to the “start” menu and do a search for system restore which will take you to the feature.

Does deleting browsing history really delete everything?

When you clear your browser history, you're only deleting the history that's locally stored on your computer. Clearing your browser history doesn't do anything to the data stored on Google's servers.

How do you clean up history?

Press Ctrl-Shift-Delete in Chrome, and you get Google's options on-screen. Check the boxes next to the categories that you want to clear. Be sure to examine all the options from the drop-down menu at the top. This menu lets you choose how much of your history you would like to clear.


1 Answers

here is the solution!

simply use:

  $ionicHistory.nextViewOptions({      disableBack: true   }); 

example for login function:

$scope.login = function () {  Security.login($scope.cred.email, $scope.cred.password)     .success(function(data) {         Security.setUser(data.data[0]);         $ionicHistory.nextViewOptions({             disableBack: true         });         $state.go('posts', {}, {location: "replace", reload: true});     }).error(function(data) {         $scope.showAlert();     }); }; 
like image 110
Tzook Bar Noy Avatar answered Sep 27 '22 22:09

Tzook Bar Noy