window.onbeforeunload: Is it possible to get any details about how the window was unloaded?
<p>I'm developing one of those warning windows that tells the user that they may have unsaved data, but I only need it to warn them if they're leaving the page. Currently it does so on refreshes, postbacks, etc. I was wondering if there was any way to tell how the page was unloaded or otherwise get more details about what the user is doing to unload the page. (jquery solutions welcome).</p>

<p>Code for reference:</p>

<pre>
    window.onbeforeunload = function () {
        if (formIsDirty) {            
            formIsDirty = false; 
            return "Are you sure you want to navigate away from this page?";
        }
    }
</pre>
