Handling access via URL and hardware back button

The structure of my application is as follows.
push(ListID)↓ ↑pop()
push(DetailID)↓ ↑pop()

The behavior of the hardware back button when accessing as a native application and when deploying on the web and accessing via URL is different.

The following is an example of operation.
In the case of a native application, it is ideal behavior.
①native app
1.TopPage ⇨ ListPage
2.ListPage ⇨ DetailPage
3.DetailPage ⇨ ListPage
4.ListlPage ⇨ TopPage
Hardware back button

1.Access to DetailPage directly from URL
2.DetailPage ⇨ ListPage
3.ListPage ⇨ DetailPage
Hardware back button
4.Eexecute pop, there is no response

For native applications, press Hardware Back button in ListPage to go to TopPage.
On the other hand, if you access the DetailPage directly via the URL on the WEB, pressing the hardware back button with ListPage will return to DetailPage.
Will the History Stack already disappear when step 3 of WEB is executed and returns to DetailPage? Because I did pop() in Step 2.

What kind of processing does the hardware back button do?
Do you do different processing from pop?
I set up the defauthistory of DetailPage as below, but the behavior still did not change.

/* app.module.ts */
      { component: DetailPage, name: 'DetailPage', segment: 'detail' , defaultHistory: [TopPage, ListPage]},

Not sure if it’s a perfect fit but you might find this useful - https://scaffold.digital/ionic-and-the-android-back-button/

Thank you very much !!!

1 Like