检测用户是否使用了后退按钮 [英] Detect if the user has used the back button

查看:67
本文介绍了检测用户是否使用了后退按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的网页在加载页面时运行javascript函数。但是,如果用户使用后退按钮返回此页面,我不希望该功能运行。如何使用javascript来阻止这种情况?

My webpage runs a javascript function when the page is loaded. However, I don't want the function to run if the user comes back to this page using the back button. How can I prevent this using javascript?

$(document).ready(function(){
  // Do not run this function if the user has arrived here using the back button  
  RefreshThePage();
});


推荐答案

我原以为使用cookies是最简单的这样做的方式

I'd have thought that using cookies is the easiest way to do this

这篇关于检测用户是否使用了后退按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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