如何阻止以下jquery函数。 我测试了不同的脚本和自己的脚本,但注意到了工作。
$(document).ready(function () {
$(window).on('beforeunload', function() {
return "\
Are you sure you want to leave this page....";
});
});
#
很抱歉,但这两个脚本都没有停止离开对话框
// ==UserScript==
// @name Test
// @namespace
// @description Disable - remove the annoying onbeforeunload event
// @include *
// @author test
// ==/UserScript==
(function() {
unsafeWindow.onbeforeunload = null;
unsafeWindow.onunload = null;
//unsafeWindow.alert = null;
//unsafeWindow.confirm = null;
//unsafeWindow.prompt = null;
//unsafeWindow.open = null;
//$(window).off('beforeunload'); //don't work
$(window).on('beforeunload',function() {/* override function that does nothing*/});
})();