I have a website with mutliple tabs and with multiple menu items with a master page.How to know when the browser/tab is closed.I need to close a thread on browser close.
I Haved tried this event
- <script type="text/javascript">
- window.addEventListener('beforeunload', function (e) {
- e.preventDefault();
- e.returnValue = '';
- });
- </script>
This event is getting invoked when i am moving from one tab to other and even from one menu item to other.I want to know only when the the browser/tab is getting closed.