title: detect back button click in browser
body: <p>I have to detect if a user has clicked back button or not.
  For this I am using </p>
  
  <pre><code>window.onbeforeunload = function (e) {
  }
  </code></pre>
  
  <p>It works if a user clicks back button.  But this event is also fired if a user click F5 
  or reload button of browser.  How do I fix this?</p>