title: Window close, using link or typing URL?
body: <p>There is a very simple problem I haven't found any solution that solves it. Is there any way <strong>to distinguish between</strong>:</p>
  
  <ol>
  <li>leaving the browser window (tab) <strong>using link</strong></li>
  <li><strong>typing</strong> another <strong>URL</strong> to the URL bar in the browser</li>
  <li><strong>closing</strong> the tab or browser window</li>
  </ol>
  
  <p>I need to bind different Javascript code for those actions. I know I can filter all links by setting them special class, but is there anything working in general?</p>