title: Detect browser close event when multiple tabs are open in Internet Explorer
body: <p>I want to detect a Browser/tab close event and then call an struts action.
  I am able to perform it when I have only 1 tab in the browser.
  below is my javascript code to detect the close event:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  function loadOut() {
          if ((window.event.clientX &lt; 0) || (window.event.clientY &lt; 0)) {
  
          document.forms[0].action="Logout.do";
          document.forms[0].submit();
      }
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>I am using onbeforeunload to capture browser close event.</p>
  
  <pre><code>&lt;body onbeforeunload="loadOut();"&gt;
  </code></pre>
  
  <p>When I close the brower with only one tab, or when I close my tab itself, then the event will fire as either of the X or Y co-ordinates would be &lt;0. (which will help me in checking that I am only closing the brower and not navigating to any other link).</p>
  
  <p>However, with multiple tabs open, I get "do you want to close all tabs or the current tab" popup from Internet Explorer. And when clicking the options, neither X not Y cordinates remains &lt;0.
  and the actions doesn't fires.</p>
  
  <p>Please help me fix this problem.</p>
  
  <p>P.S.: I can choose to remove that popup from the browser setting, but just want to know if there is any other way</p>