Quick description:
I've built a page with a shopping-cart-like ...err... cart. Users add things to their cart via a POST form. They then go to an overview of their cart & have the ability to do stuff to the cart. It's very likely that the user will look at their cart, then go back and choose more items to put in it.
The problem:
If a users adds something to the cart, then views the cart, then clicks the browser's back button to add more items, the browser tries to repost the data & displays that pesky "the previous page has post data" message. This is what I'm trying to avoid.
I tried reloading the page via php code:
header($_SERVER['REQUEST_URI']);
but I still get the same message when trying to go back.
My idea then was to redefine the back button so rather than going back in history, it goes to a new page that is the last page without POST vars.
I know there is the "window.onbeforeunload" javascript event & that I could do it in there, but that will do the same thing for all navigation away from that page - some of which could be valid.... so I only want to handle the actual back button.
any ideas? preferably simple ones.