title: Run JavaScript code on window close or page refresh?
body: <p>Is there a way to run a final JavaScript code when a user closes a browser window or refreshes the page? </p>
  
  <p>I'm thinking of something similar to onload but more like onclose? Thanks.</p>
  
  <p>I don't like the onbeforeunload method, which always yields to a confirmation box popping up (leave page/ stay on mozilla) or (reload/ don't reload on chrome). Is there a way to execute the code quietly?</p>