Hi!
How I can capture event, close browser window, in jQuery or javascript ?
Hi!
How I can capture event, close browser window, in jQuery or javascript ?
http://docs.jquery.com/Events/unload#fn
jQuery:
$(window).unload( function () { alert("Bye now!"); } );
or javascript:
window.onunload = function(){alert("Bye now!");}
You're looking for the onclose event.
see: https://developer.mozilla.org/en/DOM/window.onclose
note that not all browsers support this (for example firefox 2)