views:

181

answers:

0

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

Hi all

I have the below set of code

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

the test() will call when i close the window and also if i refresh the window ..... How can identify is it a refresh or close event . I need to call test() only at close event. Please help me...