I want to clear all of navigation history of my application mobile and, return to the first screen when I click on a logout button. It would has any plugin in the Outsystems to do that?
Raj008 wrote:
Hi Raj,
You can simple do that using Jquery or javascript .
<script type="text/javascript" > function preventBack(){window.history.forward();} setTimeout("preventBack()", 0); window.onunload=function(){null};</script>
Rahul Sahu wrote:
Thank you for quick update.
This code is not working on my OutSystems Mobile app. Here is the scenario
Here I need solution, how can clear previous screen stack before logout .
Thanks in advanced.
Kumar,
Where I put tha JavaScritp, on Initialize event?
Hi Raj008,
I also faced the same issue with login page, After user login if you press the back button it will take you to the loagin screen again. Even if you are already login.
I resolved this issue, By using GetUserId() Function value on the OnIntialize Action of the login screen. If i get the userid from the GetUserId() function then,I use the java script to force close the app.
Attaching sample oml file,for reference.
Hope this will helps you.
Regards,
Koushik
Koushik Prathi wrote:
Thank you for update.
In my case Multiple login pages are creating as stack. Single Stack should maintain.
Thanks,
Rajesh R.
The sample I provided will also work fine. with your scenario.Just give it a try.
Hi Koushik,
Your given code is working fine, but I need login page should be there. Given code exit the application completely.
Once the user is already login why we need to show him the login page again, if you provide some more info it will help me,like scenario.
Thank you for reply.
If I navigate from Login -> A -> B -> C -> then select the "Logout" option from the menu, then I should be navigated to the Login page without back stack.
I want clear navigation back history.
Rajesh R
This can be done in multiple ways.
1. The easiest way is to relaunch the app by using following Javascript code
window.open($public.BuiltinFunctions.getOwnerURLPath()+"Screen,Name"_self");
2. Use below cordova code
if (navigator.app) {navigator.app.exitApp();}else if (navigator.device) { navigator.device.exitApp();}else { window.close();}
3. If your screen already in the stack but not immediate back. Use below
window.history.go(-2); //second screen from top