Monaca Onsen UI Discord Chat Github Repo

Browser and Android back button

  • So I am confused… what I expect is that when I use “myNavigator” to move to a page when I click a button, and I click the browser back button, or my Android back button, I go back to page 1, not to the previous website in my browser’s history. Is this how it’s supposed to work? I know that, for example, in jQM, a stack is maintained and when I click the back button in the browser or on my Android device, I go back a “page” within my web app’s history. I notice that even in the kitchen sink demo for navigating pages, hitting the browser’s back button takes me back to the previous website page, not the “web app” page. I hope I am making sense. If so… am I doing something wrong, or is this expected behavior?

  • Onsen UI

    @Michael-Redwine The Android back button in Cordova apps should work well. For browsers back button, we are not modifying the history stack since this framework was originally meant for Cordova apps. Perhaps we should add it for PWAs. In any case, I think you can use navigator’s postpush event to run history.pushState and then use window.onpopstate to call myNavigator.popPage. I think that should work :+1: