1

I'm doing some AJAX page reloading and everything works great, expect that popState only works backwards. I can go back in history, but I cannot go back forward. The question is, should popState work in both directions and if not, what's the opposite method to watch for moving forward?

To be exact, I've got both on-click pushState to work and popState to return me back. What doesn't work is going forward after returning back.

Example: I click on my links 3 times and go through A-B-C states. Now, I click back and end up at B. Lastly, I want to click "forward" in the browser (and not on my app) and thus end up at C. Well, the browser state changes, but I don't end up with C. Does it mean that I have to write pushState for browser-based behavior too? I was under impression that popState should handle both back and forward behaviors?

stasiaks
  • 1,268
  • 2
  • 14
  • 31
Kirill
  • 3,667
  • 4
  • 30
  • 35
  • What about looking at this previous topic on stack overflow, [popstate][1]? [1]: http://stackoverflow.com/questions/9760387/html-5-ajax-popstate-and-pushstate – happy coder Jan 21 '13 at 06:50
  • Because it doesn't actually answer my question. I got both on-click pushState to work and popState to return me back. What doesn't work is going forward after returning back. Example: I click on my links 3 times and go through "A-B-C" states. Now, I click back and end up at B. Lastly, I want to click "forward" in the browser (and not on my app) and thus end up at C. Well, the browser state changes but I don't end up with "C" – Kirill Jan 21 '13 at 07:04
  • Alright, so after playing with this for a while, the easiest solution is the one 'happy coder' was trying to (sarcastically) imply via referencing the post above. In other words - in the popstate method, you have to once again do an ajax call and reload the page data. Doing that works, but doesn't quite answer my original question. I still want to know if there's an opposite method to popstate that does the future-reload on its own. – Kirill Jan 21 '13 at 07:29

0 Answers0