页面上的自定义dialag在JS / jQuery中卸载

时间:2014-03-19 08:29:16

标签: javascript jquery twitter-bootstrap

$(window).on('beforeunload', function(e) {
    $('#myModal').modal();    // open bootstrap modal, etc, not important
    return false;
});

这是我的代码。如何隐藏默认确认窗口和绑定按钮"离开页面"和"留在页面"在我的boostrap模式中采取适当的行动?

1 个答案:

答案 0 :(得分:0)

简单的答案是“你不能”。

beforeunload中的

The only thing you can do是设置returnValue让浏览器UI询问用户是否真的要离开。