onbeforeunload support detection
<p>I'd like to check if the current browser supports the onbeforeunload event.
The common javascript way to do this does not seem to work:</p>

<pre><code>if (window.onbeforeunload) {
    alert('yes');
}
else {
    alert('no');
}
</code></pre>

<p>Actually, it only checks whether some handler has been attached to the event.
Is there a way to detect if onbeforeunload is supported without detecting the particular browser name?</p>
