Kill unload function in JS?

Posted by Newbie on Stack Overflow See other posts from Stack Overflow or by Newbie
Published on 2010-03-12T15:12:36Z Indexed on 2010/03/12 15:17 UTC
Read the original article Hit count: 159

Filed under:
|
|

Hello! Is there a way to kill the unload function with javascript(jquery)?

I am looking for something like this:

window.onbeforeunload = function(){
    confirm("Close?")
}

or in jquery:

$(window).unload(function() {
    confirm("close?")
});

Now, on window unload I get my confirm alert but it will continue in any case. Clicking cancel it won't stay on my page. Can U help me plz?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery