title: JavaScript question: Onbeforeunload or Onunload?
body: <p>I want to store some information in localstorage of a browser when the page is refreshed or the user exits the page for future use. I figured that I'd use some JavaScript to detect the event and store the state of the page visit.</p>
  <p>Now my predicament is: shall I use <code>Onbeforeunload</code> or <code>Onunload</code> method to accomplish this objective?</p>