DEV Community

Discussion on: Is there any way to detect if a user "can go back" in PWAs (desktop PWA most specifically)

Collapse
 
ceresnam profile image
Michal Čerešňa

you can attach custom object when calling history.pushState()

We solved it with storing 'depth' parameter. Each time user goes down we increase it by +1.

Then you can decide if the back button should be on/off with history.state.depth > 0