我处于关闭页面时必须获得窗口关闭确认的情况。//代码
window.onbeforeunload=function(){
if(...)
{
return "Are you sure you want to close this window, some changes are pending?";
// need to call a callback function when a user clicks "Leave this page" button.
}
};
这将创建一个确认窗口,当用户单击“离开此页面”按钮时,我需要调用一个回调函数。有任何想法吗?