DEV Community

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

Collapse
 
stereobooster profile image
stereobooster • Edited

Maybe you are looking for window.history.length? UPD: just double checked, it doesn't subtract the number when you use back button :/

Collapse
 
kognise profile image
Kognise

Maybe there's a way to do some programming magic and get that to work?

Collapse
 
ben profile image
Ben Halpern

Between that and other persistence like localStorage etc, there is probably a technically possible way to make it happen. We only have to worry about on-site situations because this is for the standalone app.

This is a pretty generalizeable situation so if anyone wanted to build a library for this I'm all for it! πŸ˜„