URL Tokens?


I’m working on a website (Magento Shopping Cart) and during checkout that has six steps and loads each with a javascript. When the customer clicks continue the next step “slides” in. The URL stays the same.

But if the customer clicks his browsers back button it takes him back to the cart view page or what ever page he was on before going to checkout.

I thought about somehow disabling his browsers back button or show an error if he clicks his back button. Because he’ll lose his information for his order.

I’ve been reading and it seems there might be something else better. Some kind of url token but I’m not sure what exactly that is. Ideally, I would like to make it so when he clicks his back button it takes him back one step in the checkout process. I thought if I could somehow add something in the URL that changes it (token?) then the back button would work like I would like.

I’m not sure if this is a javascript problem or what?

Any advice is weclome


To save and later retrieve state of page html5 history api could be used http://diveintohtml5.info/history.html in addition data about cart contents can be stored in browsers localStorage. Or [URL=“https://developer.mozilla.org/en-US/docs/DOM/window.onbeforeunload”]window.onbeforeunload event can be used to confirm user pressing back button, like gmail does.


Very interesting reading. Might be a little over my head thou.:scratch:

Sounds like a job for History.js :slight_smile: