views:

240

answers:

2

How to detect window closing event when user press Alt+F4 or using javascript window.close() in Gecko based browsers?

A: 
window.onbeforeunload =function(){return '';}
S.Mark
I think, it will 'onbeforeunload' fire when a new page get loaded.
Rajeesh
A: 

.......

window.onunload = function(){
   alert('I am getting closed !!');
};
Sarfraz
I think, it will 'onunload ' fire when a new page get loaded
Rajeesh