title: Best way to detect when a user leaves a web page?
body: <p>What is the best way to detect if a user leaves a web page?</p>
  
  <p>The <code>onunload</code> JavaScript event doesn't work every time (the HTTP request takes longer than the time required to terminate the browser).</p>
  
  <p>Creating one will probably be blocked by current browsers.</p>