In my PHP site, when a user adds something to their cart I trigger a URL change to make some functions and triggers on the page:
Original URL
/category/product/10
New URL
/category/product/10#addtocartbutton
URL becomes
/category/product/10?x=1
The method:
/category/product/10
/category/product/10#addtocartbutton (user clicks an onclick href to submit form)
/category/product/10?x=1 (the form adds the item to the session and appends this URL querystring)
The problem is when they press the bac b
In
Javascript, usinglocation.replaceinstead oflocation.href = 'new location'Take a look at: http://www.roseindia.net/javascript/javascript-location-replace.shtml
->
location.replacewill replace the current address by the new one -> when user click back button -> error will not happen.