DEV Community


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

stereobooster profile image

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

kognise profile image

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

ben profile image
Ben Halpern Author

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! 😄