How to prevent from misclose browsers
I have a Web Application and I want to get a confirmation from users when they are closing the application no matter what.
I mean I'm looking for a way to display a message touser whenever user try to close the application.
Update : I want to use my dialog开发者_运维百科 box not browsers dialogbox. r at least a dialogbox which only shows my message no extra message.
No need for jQuery here, just hook up the window beforeunload event
Demo
window.onbeforeunload = function() {
return "Are you sure?";
}
精彩评论