Handling access via URL and hardware back button


#1

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

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
push()
2.ListPage ⇨ DetailPage
push()
3.DetailPage ⇨ ListPage
pop()
4.ListlPage ⇨ TopPage
Hardware back button

②WEB
1.Access to DetailPage directly from URL
2.DetailPage ⇨ ListPage
pop()
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]},


#2

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


#3

Thank you very much !!!