title: To have an ajax call using javascript before window is closed in IE
body: <p>I need to make an AJAX call using javascript before window is closed in IE</p>
  
  <pre><code>function fun(){
      if((window.event.clientX&lt;0) || (window.event.clientY&lt;0)) {
        //Make the ajax call
      }
  }
  </code></pre>
  
  <p>I have called the function <code>onload</code> of my webpage, it is working fine for browser having single tab but failing for browser having multiple tabs.</p>
  
  <p>I have also tried calling</p>
  
  <pre><code>onbeforeunload="function callAjax();"
  </code></pre>
  
  <p>in <code>&lt;body&gt;</code>. But it also calling at the time when I am using </p>
  
  <pre><code>window.close()
  </code></pre>
  
  <p>to close popups.</p>
  
  <p>PS: I don't want to use jQuery. </p>