I am trying to find out a way such that when the hardware back button is pressed, if I am on the application’s main page, the application will simply exit. But if it is on the other pages, then it would simply navigate back to each page until it reaches the main (home page).
Current structure of the HTMLs:
index.html home.html page1.html sub-page-a.html sub-page-b.html page2.html sub-page-c.html sub-page-d.html
Currently, what’s happening is that when I am at home page, I click on button and goes to page1. I click on the home button to go back to home.html. Then I would go to page2.html all the way to sub-page-c.html. Now when I click the back button, I go from sub-page-c to page2 to home then to page1.html. What I want to achieve is whenever I am already at home.html, the back button will simply correspond to an exit application.
Side Question: Just wondering, if you are using the Chrome Debugger and using the emulator for the application, is the browser back button the same as the back button for the hardware (Android device)? Or would it still be preferable to generate an APK and load it to your device and test?