我怎么知道,如果用户点击"返回]按钮? [英] How do I know if the user clicks the "back" button?

查看:88
本文介绍了我怎么知道,如果用户点击"返回]按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的锚具有独特的URL处理一个ajaxy网站。不过,我想,当用户点击浏览器的后退按钮,这样的内容总是匹配的网址重新加载内容。

I'm using anchors for dealing with unique urls for an ajaxy website. However, I want to reload the content when the user hits the Browser's "back" button so the contents always matches the url.

我怎样才能做到这一点?是否有一个jQuery的事件,当用户点击后退?

How can I achieve this? Is there a jQuery event triggering when user clicks "Back"?

推荐答案

您需要使用hashchange事件。有几个流行的插件。我一直在使用的地址插件,喜欢它。有些人会认为烧烤也。

You need to use a hashchange event. There are a couple of popular plugins. I've been using the address plugin and like it. Some will suggest BBQ also.

地址插件

jQuery的烧烤

这篇关于我怎么知道,如果用户点击"返回]按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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