Hi,
In certain flows, I have a intermediate page that forks to either a preview page or full page depending on whether a user is subscribed or not.
The only problem is, if they try to click “back” on whatever page they end up, it redirects them to the “forking” page, which then redirects them again to the same final page they were just on.
Is there a way to go back 2 pages when the user clicks “back” so that they end up where then intend?
Simple. Store the page in a variable. Use customJS to save:
return window.location.href
You can see how I handle this on what.gift when you click a gift. It loads a modal and the URL in the browser changes and then when it closes, it reverts back. It’s not changing a page, but editing the browser url should a user want to save/share that URL it’ll correctly navigate them to the right page.
Storing the page got complicated in my case, because I would need to store a chain of previous pages in some circumstances.
Instead, I made a custom. back button for this specific page and used the following custom JS when the custom back button is clicked history.go(-2)