有没有办法检测用户是否使用jquery或javascript按下了刷新按钮? [英] Is there a way to detect if the user has pressed the refresh button using jquery or javascript?

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

问题描述

我想知道jquery或javascript是否可以检测用户是否按下了浏览器的刷新按钮?如果是这样我可以看到一个例子吗?

I want to know if jquery or javascript can detect if the user has pressed the refresh button of their browser? If so can I see an example?

推荐答案

window.onunload事件将在页面刷新之前被触发。

window.onunload event will be fired before the page is going to be refreshed.

window.onunload = function(){
    alert("unload event detected!");
}

这篇关于有没有办法检测用户是否使用jquery或javascript按下了刷新按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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