📜  关闭窗口时的 javascript 提示 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:11.589000             🧑  作者: Mango

代码示例1
// custom message prompt is no more supported (only IE does)
window.addEventListener("beforeunload", function(e) {
    if( someBusyFlag )
    {
          // ask for stay
        e.preventDefault();
          // Chrome requires this var set
          e.returnValue = '';
    }
    else
    {
        // grant quit
          delete e['returnValue'];
    }
});