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:
if (window.onbeforeunload) {
alert('yes');
}
else {
alert('no');
}
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?