I have a single page app and my users have complained that they are taken out of the app when they hit the browser back button. Sometimes this causes them to lose work, so it’s a pain. There have been some posts on this in the forum, but I wasn’t able to find a simple solution to this problem so I’m posting a potential solution here.
To get it to work in Bubble:
- Create a workflow “When Page is Loaded” (or if you already have one then use that)
history.pushState(null, null, window.location.href);
window.onpopstate = () => history.forward();
It’s sort of a hacky workaround, but it gets me mostly what I want in both Chrome and Edge. Haven’t tried other browsers. Some posts I found say this is not advised, that you shouldn’t mess with the browser functions, so do this at your own risk I guess :> It’s easy to try and test if you want to give it a shot.