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.onbeforeu
I realize I'm a bit late on this one, but I am dealing with this now, and I was thinking that something more like the following would be easier and more reliable. This is jQuery specific, but it should work with any system that allows you to bind and unbind events.
$(window).bind('unload', function(){
alert('unload event');
});
window.onbeforeunload = function(){
$(window).unbind('unload');
return 'beforeunload event';
}
This should unbind the unload event if the beforeunload event fires. Otherwise it will simply fire the unload.