确认导航无效

时间:2014-09-17 11:25:23

标签: javascript

我已经看过这个但是它不适合我

 var needToConfirm = true;

window.onbeforeunload = confirmExit;
function confirmExit() {
    if (needToConfirm)
        return "You have attempted to leave this page.  If you have made any changes to the fields without clicking the Save button, your changes will be lost.  Are you sure you want to exit this page?";
}

1 个答案:

答案 0 :(得分:0)

我能够使用jQuery的IE和FF工作:

$(window).bind('beforeunload', function(){

});