2016-09-26 57 views

回答

0
window.onbeforeunload = ConfirmExit; 

function ConfirmExit() { return "closed...."; }

+0

這不是jQuery的實現 – argoden

0

使用 '卸載之前關於' 事件:

<script type="text/javascript"> 
    window.onbeforeunload = onbeforeunload_handler; 
    window.onunload = onunload_handler; 
    function onbeforeunload_handler() { 
     // Do something here 
    } 

    function onunload_handler() { 
     // Or do something here 
    } 
</script> 
相關問題