How to distinguish Unload Event triggered by Refresh or Window Close?

China☆狼群 提交于 2019-12-23 09:02:22

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/3115773/how-to-distinguish-unload-event-triggered-by-refresh-or-window-close

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!