|
JavaScript only knows if the page is about to be unloaded - it doesn't know why the page is being unloaded. It therefore can't distinguish between reloading the current page, going to another page on the same site, going to a page on a different site, or closing the current tab, or closing the browser.
You might be able to set something from a click event on links in the page that you can test for from the beforeunload code to detect if the reason for the unload is that they clicked a link - that would get rid of some of the unloads not related to closing the browser.
|