title: javascript's unload and beforeunload alternative
body: <p>I need to monitor when the user moves away from a page (to a different site not the same site) or closes the window/tab. I can achieve that with <code>$(window).bind('unload', function() {});</code> but <code>onload</code> is a catch-all event: it also catches page refresh and navigating to a different page on the same website. How can I detect those two events (page refresh and navigating to another page in the same website) using javascript/jQuery please?</p>