Force Application refresh on back button
-
16-09-2019 - |
Question
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!
Solution
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.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow