How do I capture the browsers Tab Close
-event in JavaScript or EXTJS. I have tried the following:
<script>
window.onunload = (function(){
return 'stay page ......';
});
</script>
as well as
<script>
window.onbeforeunload = (function(){
return 'stay page ......';
});
</script>
but this onunload
is not working and onbeforeunload
is working for page refresh
and page close
events. Please help me.
http://stackoverflow.com/questions/3888902/javascript-detect-browser-close-tab-close-browser