We have a filter that lets the user filter between different options in a list and then dynamically shows the results with ajax. But, If a user choose one of the results and so beeing directed to a new page, but then decides to hit the browser back-button, the results and filter is reset. Is there any way to make it not reset when hitting the back-button?
Im aware i’m not supplying you guys with any code here just wondering if there is some general solution to stuff like this.
Sure thing. When the page loads, check if there is a fragment identifier. If there isn’t then keep loading as per normal.
If you’re using jQuery then a nice hash change event plugin exists, which fires a callback whenever the hash changes. This allows you to check what the changed has is (which occurs when going back a page) and deal with things based on the existing state of things.