onbeforeunload の原因が閉じるボタンのクリックによるものか、ページの更新によるものか、または一般的に onbeforeunload の原因となったイベントを特定するにはどうすればよいですか?
ここにスニペットがあります:
window.onbeforeunload = function( e ){
if( !e ) e = window.event;
// insert code to determine which is the source of the event
}
私を助けてください。