title: Save HTML5 video currentTime before user leaves or closes page
body: <p>I would like to save the position of HTML5 video's <code>currentTime</code> to the database when user leaves a web page. It seems like <code>window.onbeforeunload</code> is not a reliable way to do it (not to mention it gives an undesirable popup window!). Is there a better way to do this?</p>
  
  <p>I can't think of anything other than saving the position to the server periodically. But that seems wasteful resource/bandwidth wise. Netflix seems to do a good job at remembering your last viewed position. How would they be able to achieve that reliably? Low-level server-side C/C++ code maybe?</p>