Based on the discussion in this post:
Is there any way to detect if a user "can go back" in PWAs (desktop P...
For further actions, you may consider blocking this person and/or reporting abuse
Would this meet your needs?
npmjs.com/package/back-forward-his...
Based on the history library, it lets you set up a listener for state change events (including back/forward), and has a handy
canGoBack()method. I haven't used it, but it seems like it would work for a PWA.Oh it just might be, I'll check it out in more detail tomorrow.
P.S. I owe you an email reply. I'll get to that tomorrow too 😊
Oh my, I spent over a year at my last job making a history system that was state aware and could support such navigation requests. It was for mobile though, not web -- the web one I did five years ago. That tech has probably been replaced about 10 times by now in the web world. :D
github.com/browserstate/history.js/
It's old, outdated. But it does work with all desktop and mobile browsers I've ever tried. Though their own notes say anything modern should just use the native APIs.
Of course, if this already exists, let me know! 😄
I'd like to know too 😁