[英]How to display a bootstrap modal for window.onbeforeunload alert?
I want to display a twitter bootstrap modal when the user clicks the back,forward or refresh browser button,but I am not getting the desired o/p.This is what I tried : 我想在用户单击后退,前进或刷新浏览器按钮时显示一个twitter引导模式,但是我没有得到所需的o / p。这是我尝试的:
@section Scripts{
<script type="text/javascript">
function myFunction() {
return $('#cancel_modal').modal('show');
}
</script>
}
and called it in the body : 并在体内称呼它:
<body onbeforeunload="return myFunction()">
Note: #cancel_modal is the id of the <div>
where bootstrap modal is defined. 注意:#cancel_modal是定义引导方式的
<div>
的ID。
I don't think this is possible. 我认为这是不可能的。 Please see this SO question for more information.
请参阅此SO问题以获取更多信息。 Dialog box runs for 1 sec and disappears?
对话框运行1秒钟,然后消失?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.