title: Execute function before refresh in Angular 2/4
body: <p>On <code>HTML</code> page, When user click / press <code>F5</code> button page refresh but before refresh I want to execute one function or a simple alert.</p>
  
  <p>User can click on refresh button, press <code>F5</code> or <code>Ctrl + R.</code></p>
  
  <p>using <code>Angular</code>2/4</p>