How is it possible to identify that the browser\'s close button was clicked?
You should use onbeforeunload
, not onunload
. IE 7 (and perhaps other browsers) are not 100% reliable when it comes to firing the unload
event, but it seems to always fire the beforeunload
event.
for example:
window.onbeforeunload=function(){}
or, if you are using prototype.js:
Event.observe(window, 'beforeunload', function(){});