views:

442

answers:

1

I have a web app which pulls in information via ajax after the page loads. When a user leaves the page, then hits the 'back' button in their browser, they see the page as it looked on initial load. What I need to have happen is have all javascript run as if they hit the 'refresh' button.

I have tried setting the Cache-Control and Pragma headers, but this didn't help. I know this is possible, as Google does it in many of their applications, such as gmail and google reader. Any ideas?

Thanks!

+1  A: 

Have a look at Really Simple History - it's a JavaScript library that lets AJAX applications interact with the Back and Forward buttons using the same techniques that Gmail and family use.

RichieHindle
Thank you very much, that did the trick! I didn't think I needed a history manager since I didn't care about backing through multiple ajax events, it was only the last state that I cared about. Still, I got RSH implemented, and it's working smoothly now!