$(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
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745484164a4629691.html
评论列表(0条)