Force Application refresh on back button

江枫思渺然 提交于 2019-12-11 08:32:29

问题


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:


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.



来源:https://stackoverflow.com/questions/1470249/force-application-refresh-on-back-button

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!