有没有办法在下面的代码中检测到用户是点击了“离开页面”还是“留在页面”的按钮?
$(window).on('beforeunload', function (){
return "You save some unsaved data, Do you want to leave?";
});