Capturing result of window.onbeforeunload confirmation dialog
问题 Is there a way to capture to result of the window.onbeforeunload confirmation dialog like the one below from Stack Overflow (this happens when leaving the 'Ask Question' page without posting the question)? This is how it appears in Chrome, I believe it's slightly different in other browsers, but you always have some form of yes/no buttons. Presumably if they're still on the offending page after the event has been triggered they chose to stay and you could probably figure this out by watching