如何区分由刷新或窗口关闭触发的卸载事件? [英] How to distinguish Unload Event triggered by Refresh or Window Close?

查看:153
本文介绍了如何区分由刷新或窗口关闭触发的卸载事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

卸载事件可以通过刷新操作和窗口关闭操作触发。有没有办法区分实际触发它的动作?在我的情况下,我想忽略刷新动作。可以请给我一些洞察力,这些工作是什么?

Unload Event can be triggered both by Refresh action and Window Close action. is there a way to distinguish which action that actually trigger it? In my situation, i want to ignore the Refresh action. Could you please give me some insight what the work around is?

我注意到已经有这样一种问题问,但似乎他们都没有解决。因此,我再次提出了这个问题,希望有一个聪明的人可以解决这个问题。

I noticed that there is already this sort of question asked, but it seems to they are all unresolved. Therefore i came up this question again and hopefully some intelligent guy can solve this problem.

推荐答案

我不相信浏览器可以区分两个事件之间。

I do not believe the browser can distinguish between the two events.

两个都是一个卸载事件,两者都会调用任何卸载您所做的功能。

Both are an unload event, and both will call any unload function that you have made.

这篇关于如何区分由刷新或窗口关闭触发的卸载事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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