title: Save record on page leave
body: <p>I am saving records on save button click, if user don't click save button and navigate to another page while clicking on some link even then i want to call the save method. 
  How can I achieve this functionality?</p>
  
  <p>please provide some sample code ...</p>
  
  <p>thanks in advance for your help</p>