On my website I have some javascript which changes the URL by adding # and some information as the user takes some action.
for example:
www.mysite.com/index.html#shoes=23,books=12
www.mysite.com/index.html#shoes=24,books=12
The website works brilliantly but the back button appears to be broken
When the user presses back I don’t want to move back to my previous values on the url with the hash but I really want to go back, like moving away from the page.
Can somebody help ?
This is a feature of the browser: visiting a new URL with a hash is a separate history item. You will not be able to solve this without changing how you handle URLs. From a UI perspective, this seriously makes sense. Imagine if gmail didn’t do this (like in the old days). The user experience would be significantly diminished.
Unless this breaks your app, I suggest you leave it as it is; your users will thank you for it.