window beforeunload 事件

回调方法里面只能返回 字符串

window.onbeforeunload = funcRef
  • funcRef is a reference to a function or a function expression
  • The function should assign a string value to the returnValue property of the Event object and return the same string
window.onbeforeunload = function(e) {
    return 'Dialog text here.';
};

jQuery(window).unbind("beforeunload").bind("beforeunload", function() {
return ' ';
});

原文地址:https://www.cnblogs.com/amosleaf/p/2936551.html