停止重定向并显示对话框

Stop redirect & show the dialog

本文关键字:显示 对话框 重定向      更新时间:2023-09-26

我想显示对话框消息以确认重定向,但我有自己的对话框窗口,因此代码(如下所示)对我来说不行。

window.onbeforeunload = confirmExit;
function confirmExit(e) {
    return "Do you realy want to leave the page, miserable user?";
}

如果我使用,我的菜单会显示,但在我选择任何变体之前页面重定向(是/否):

window.onbeforeunload = confirmExit;
function confirmExit(e) {
    return pcDialog.Show();
}

我该如何解决这个问题?

这目前是不可能的,并且是已知的安全限制。