如何阻止以下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*/});
})();