disable back button mobile


How can I disable back function from my native mobile in OS ?

So if User press the back button, nothing happened.

Hi tBt,

What do you mean by "back button"? There's no back button in a native app unless you create one in the interface.

Hi Killian,

The button that in red box.


I don't think you can, that's an operating system button, independent of your app.

Is there any way to detect that it was pressed and to take an action based on that?


I don't think this is possible in OutSystems.
It is if you are developing, for example, directly in Android Studio (for Android case).

But It is a TERRIBLE idea to prevent the user of using the back button.
You are trying to prevent the user to use a standard function of ANY mobile.

Don't do that. Bad. Very bad. User will not be happy...

Eduardo Jauch

José Costa wrote:

Hi JM,

Have you seen this post?




Nice Topic you found, José :)
I din't know it was possible to do that in OutSystems (even if you had to mess with Cordova).

I still don't like messing with standard behavior unless strictly necessary (like for security reasons).

Yet, there are other approaches to prevent seeing previous data on backing that requires a little bit more logic, like storing information and validating it when entering a page to see if should reset or not the data, form, etc.

The advantage is that you do this without messing around with system functionality that always makes the application more dependent on third party (without guarantees of maintenance) and less flexible, transparent and scalable. 

Eduardo Jauch

Thank you all for the insights.  Much appreciated!

  -- Joel

Hello JM and tBt

On other thread, I found this link, that I think will be very useful to you to control the behavior of the Back Button.
It seems that I was wrong and if not possible to "disable" the Back Button, it is very easy to control its behavior, like redirecting to a specific page you want.

Eduardo Jauch


You can manupilate the logic behind the 'android' back button within OutSystems trough a JavaScript API. In the post from Eduardo you can find the link (https://success.outsystems.com/Documentation/10/Reference/OutSystems_APIs/JavaScript_API/Navigation) to the OutSystems 'help' page how this API functionality works.

In normal words: you can see the android back button as some kind of memory where you need to send the screen location you are navigating too so android 'knows' where it needs to go when a user hit the android back button. So see it as an list in android with all screens you have seen as an user, when you hit the android back button it goes to then screen and deletes that screen(record) from the list.

Hope it become little bit more clear on this way?

Kind regards,

Hi Ed and Evert, 

Sorry I am not that familiar with javascript things so I am bit confused on how to apply it to my modules.

What I want to achieve is when in login screen, when user press 'back' button, it will close the app.

My case now, user logout from app, then it redirect to login screen. After that, when press back button, it goes to previous screen and directly back to login screen (because the screen it redirect needs registered user).


Would love to check a solution for you, but have so little time to do so. Where you already able to get any further with this yourself?

Kind regards,

Hi Evert, 

nope, still confused how to use it.

When I tried to use like I explain above, my app is error, haha.

Hello tBt,

Will check if I have some time end of this week to check this functionality for you, will get back on this.

Kind regards,