如何使用jQuery区分刷新和关闭事件?

时间:2010-03-10 06:29:39

标签: javascript events jquery

  

可能重复:
  Is there a way in javascript to detect if the unload event is caused via a refresh, the back button, or closing the browser?

大家好

我有以下代码集

$(window).unload( function() {
   test();
});

test()将在我关闭窗口时调用,如果我刷新窗口......如何识别它是refresh还是close事件。我只需要在关闭事件中致电test()。请帮帮我......

0 个答案:

没有答案