当用户点击后退按钮浏览器追踪 [英] Track when user hits back button on the browser

查看:100
本文介绍了当用户点击后退按钮浏览器追踪的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能当用户点击浏览器的后退按钮来检测?

Is it possible to detect when the user clicks on the browser's back button?

我有一个Ajax应用程序,如果我能检测什么时候上的后退按钮用户点击我可以显示相应数据传回

I have an Ajax application and if I can detect when the user clicks on the back button I can display the appropriate data back

使用PHP的任何解决方案,JavaScript是preferable。地狱在任何语言的解决方案是好的,只是需要的东西,我可以转化为PHP / JavaScript的

Any solution using PHP, JavaScript is preferable. Hell a solution in any language is fine, just need something that I can translate to PHP/JavaScript

哇,所有优秀的答案。我想使用雅虎,但我已经使用了Prototype和Scriptaculous库和不想要添加更多的AJAX库。但它使用的iFrame,给了我一个很好的指针,写我自己的code。

Wow, all excellent answers. I'd like to use Yahoo but I already use Prototype and Scriptaculous libs and dont want to add more ajax libs. But it uses iFrames which gives me a good pointer to write my own code.

现在其他的dilemna,不知道该选择为接受答案

Now the other dilemna, Not sure which to select as "accept answer"

此外,如何地狱,你在回答评论?我看没有任何联系!

推荐答案

有做这件事的多种方式,虽然有些只能在特定的浏览器。一,我知道了我的头顶部是嵌入在页面上一个微小的几乎看不见的iframe中。当用户点击后退按钮iframe要浏览回来,你可以检测到,然后更新您的网页。 这里是另一种解决方案。

There are multiple ways of doing it, though some will only work in certain browsers. One that I know off the top of my head is to embed a tiny near-invisible iframe on the page. When the user hits the back button the iframe is navigated back which you can detect and then update your page. Here is another solution.

您可能还想要去的东西,如Gmail查看源代码,看看他们是怎么做的。

You might also want to go view source on something like gmail and see how they do it.

这里的一个库之类的事情你的方式寻找

Here's a library for the sort of thing you're looking for by the way

这篇关于当用户点击后退按钮浏览器追踪的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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