title: How to popup when a visitor exits from a website
body: <p>My company creates web surveys and once in a while I get asked if we can do an exit survey on a website. So when a visitor is about to leave the site a "popup" appears asking if they'd take a quick survey. By "popup" I'm referring to a floating CSS div, not a child window (although sometimes clients don't realise this).</p>
  
  <p>Is it technically possible to code a genuine exit survey? </p>
  
  <p>I don't think so but am I missing something? The <strong>onbeforeunload</strong> event is close to the functionality required but the message and buttons aren't fully customiseable to make it usable.</p>
  
  <p>The current trend for implementing an exit survey is to popup an invite at the start of the visit, and if the user says ok then a child window is opened and focus set back to the main window. At the end of the visit the users sees the child window. I swear I've never seen a "popup on exit" survey (unless by coincidence).</p>