Handling Android back button

Hi Everyone, I havent worried about this so far as I’m mainly iOS, but recently I got some users on android and I tried it the other day and was appalled at the mess created by the android back button, it basically puts you a html form load behind which causes issues such as missing headers and lack of any way to get out of it, navigation issues I had never even see with browser or iphone. Is there a way to simply disable the android back button from affecting my app? Or alternatively actually catching the button press and mapping it and handling back navigation properly in my app, i.e. there are some forms that have their own back button to get back to the main dashboard, but if I’m in the dashboard, back should do nothing. I tried fiddling with browser arrows on and off but it didn’t appear to have any effect.

First step is to try the sample: BrowserArrows.

Does it work properly for you?

The BrowserArrowsEnable property works fine. However, I’d like to capture the back button on Android in a web app and perform my own navigation, as I only have one form (the BrowserArrowsEnable only works with the AS ChangeForm command with multiple forms.)

First, I was wrong, I do have 2 forms. A splash screen and main form. By turning on BrowserArrowsEnable, AS changes the URL of your app to include #formname. So when the user presses the back button, the browser goes back one URL to the last form of your project. Without this property, the browser will go back to the page before your app.

If you used odd form names, you’ll probably want to clean them up as the user will now see them.

There is no way using this feature that you can stop a back button from being processed. What you can do, as I have now done, is add an onshow event to the, in my case, splash screen. When this event fires, I check my program status, and if it’s still running, then I do a history.forward() call and process the back button my way.

// This traps the event after you've moved to the splash screen.
Splash.onshow = function() {
    if (TopScreen() == 'Welcome') {
      } else {
      if (NavGoPrev) {
        } else {
        if (NavGoBack) {

In my software, if the Welcome screen is shown, I add an extra back function to skip past the splash screen back to the screen before the app. Otherwise, I move forward to the original screen, and then based on some particulars, I perform navigation.

I really don’t like this solution. After the splash screen initially displays, I remove all the images, text, etc and set the background to white. That way the splash only shows as a screen flicker when the back/forward are processed.

I see AS is using navigo.min.js. I’ll have to look at how it works. I’ve tried to get beforeunload to prevent the default operation, but the back button is marked as a not cancelable event. You can provide notice the user is leaving, but you can’t stop them, nor can the user stop it.

Yes, we’re using Navigo 7. We tried 8, but there were a number of issues.