John
John

Reputation: 4261

Issue with regular links and use of pushstate and popstate

This is how my flow works. User clicks on a link - "find", and is shown a page using ajax. I add to history using pushState. Then, the user clicks next to see results of page 2(using ajax), and I add again to push state. So, this works fine, when the user goes back. But, my issue is that say user is on page 2 of results, and clicks a regular link(i e no ajax call). He is taken to a new page, but when he clicks back, he is not taken to results page 2 but to the initial search page.

Is this normal behavior? Or can something be done?

Upvotes: 0

Views: 151

Answers (1)

jholster
jholster

Reputation: 5136

Sounds like your search/result page is not properly updating its state when loaded. When you go back from "regular page", the "ajax page" is reloaded and thus loses its state. You must manually restore the state (e.g. read the url and doing the corresponding ajax).

Upvotes: 1

Related Questions