在后退按钮上强制刷新应用程序 [英] Force Application refresh on back button

查看:89
本文介绍了在后退按钮上强制刷新应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Web应用程序,该应用程序在页面加载后通过Ajax提取信息.当用户离开页面,然后在浏览器中点击后退"按钮时,他们会看到页面在初始加载时的样子.我需要做的是让所有JavaScript都运行,就像它们按下刷新"按钮一样.

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.

我尝试设置Cache-Control和Pragma标头,但这无济于事.我知道这是可能的,因为Google在许多应用程序(例如gmail和google reader)中都做到了.有任何想法吗?

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?

谢谢!

推荐答案

看看真的很简单历史记录-它是一个JavaScript库,可让AJAX应用程序使用Gmail和家人使用的相同技术与后退"和前进"按钮进行交互.

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.

这篇关于在后退按钮上强制刷新应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆