title: Popup before window is closed
body: <p>I want to open a custom popup box when browser close button is pressed, I want to ask a question to the users exiting that why are they leaving my site. I have checked quite few posts but the best thing I found is something like this post</p>
  
  <p><code>http://stackoverflow.com/questions/10847156/jquery-dialog-box-before-closing-browser-window</code></p>
  
  <p>But this just opens a browser default confirm box. I want to open a custom box like colorbox. My page is <code>http://cwstudio.in/browserclose/</code> </p>
  
  <p>right now I am using <code>alert</code> function to open the popup but if I donot use the alert, the browser donot waits for my popup and just close it.</p>
  
  <p>Any help is appreciated.</p>
  
  <p>Thanks</p>