title: Want to call a functionality on window.onbeforeunload
body: <p>I need to call functionality in window.onbeforeunload as below,</p>
  
  <pre><code>    window.onbeforeunload = function() {
          getMyApp("mySwf").cancelFunction(); 
    }
  </code></pre>
  
  <p>But the problem is window is getting closed before the functionality gets called. Could somebody help in fix this issue?</p>