Create a screen locker for cordova/bootstrap5 mobile app

Hi
i would like to create a sort of “locked screen” in my app.
I created a bootstrap modal full page, no close on click with a form to provide password to unlock.
This works well but when I click on android device back button, the modal hides.
How can I disable back button when the modal “locked screen” is shown ?
If it’s not possible what should be an alternative ?
Thanks.

Hello there! If I understand your goal correctly since it involves a password, I should note that there are many other workarounds to get around a full-screen modal (beyond the Android thing).

I’d suggest using a different method entirely (logging in and out or switching a variable you create to track this comes to mind) rather than a modal popup covering the info. The goal would be to make it difficult for someone to just view page source and get access to the data.

Thanks nomad for your reply.
I will try to find a solution with login / logout. On mobile is not so easy because there isn’t a security provider enforcer at page level.

2 Likes

Are you using a database that could handle tracking this as a variable along with each logged-in user? If so, I’d consider that as one option. Store the variable locally upon successful login; use a button or whatever to clear the variable to empty the screen (forcing the user to login and re-get the variable, whether stale from a stored database entry or generated on the fly by the server). I’m not suggesting this is the best way, so hopefully some others will chime in with better workarounds.