title: Can I "redirect" user in onbeforeunload? If can't, how to?
body: <p>Is it possible to redirect to another page when the user closes the browser?</p>
  
  <p>Attempts:</p>
  
  <ol>
  <li><p>I tried onunload, does not work</p>
  
  <pre><code>window.onunload = function redirect(){...}
  </code></pre></li>
  <li><p>I also tried another method, it doesn't work either:</p>
  
  <pre><code>window.onbeforeunload = redirect(){...}
  </code></pre></li>
  <li><p><code>&lt;body onbeforeunload="return false; redirecty()"&gt;</code></p></li>
  </ol>
  
  <p>The 3rd method, I want to cancel the <code>onbeforeunload</code> (means delay closing the browser), the I call the redirect function, <code>window.confirm</code>, if yes redirect, if no then close the browser. But it does not work as well.</p>
  
  <p>Is there any other way?? Maybe prompt to let user select whether to redirect to new page when he/she close the browser? I'm running out of ideas...</p>