停止重定向&显示对话框

时间:2012-06-11 10:02:11

标签: javascript asp.net-mvc-3

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

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();
}

我该如何解决这个问题?

1 个答案:

答案 0 :(得分:3)

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

相关问题