Is there a way using JS of accessing the history state of the previous page when a user clicks the 'back' button?
Unfortunately you're not allowed to read previous or next states.
All you can do is reading current state, using history.state
.
But if it all happens on the same page without reloads, why don't you save data on you own stack. You can use array for this - just save the same data to array and new state.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With