admin管理员组文章数量:1430358
$(window).bind('beforeunload', function() {return 'Are you shure?';} );
How I must do that if user click CANCEL button page will be redirect to ?
$(window).bind('beforeunload', function() {return 'Are you shure?';} );
How I must do that if user click CANCEL button page will be redirect to http://mypage.?
Share Improve this question edited Dec 2, 2010 at 19:49 user515503 asked Dec 2, 2010 at 19:35 user515503user515503 2051 gold badge5 silver badges14 bronze badges 2- 1 Were they already going there? or you want to redirect them to somewhere unexpected? – Nick Craver Commented Dec 2, 2010 at 19:39
- If user want close page in brawser, that brawser send confirm message and if they click CANCEL button that page is redirect! No OK button! Sorry – user515503 Commented Dec 2, 2010 at 19:49
2 Answers
Reset to default 5You cannot change what happens when the user clicks one of the buttons in the dialog. This is intentional. Nobody wants to have web sites that mess with your navigation to that level.
yes you can u do
$(window).unload(function() {
var answer = confirm("Are you sure?")
if (answer){
alert("Bye bye!")
}else{
alert("Thanks for sticking around!")
}
});
i just noticed that it wont prevent them from closing the window but it will show a confirmation when you close it >.<
it must be possible though since stackoverflow is doing it... try writing an answer and then close the windows you'll get a confirm box
本文标签: javascriptConfirm message on browser page closeStack Overflow
版权声明:本文标题:javascript - Confirm message on browser page close - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745484163a2660307.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论