Confirm box when browser/Tag close button clicks

Posted by user1316760 on Stack Overflow See other posts from Stack Overflow or by user1316760
Published on 2012-04-06T05:27:03Z Indexed on 2012/04/06 5:28 UTC
Read the original article Hit count: 183

Filed under:

I have created my website for this I like to create confirm box when user clicks browser close button.....

So i created my coding as

window.onbeforeunload = bunload;
    function bunload() {
        dontleave = "Are you sure you want to leave?";
        return dontleave;
            }

By this coding I got confirm box for each and every time when browser get loading.....I need confirm box when user only clicks browser close button......

Can anyone give me a idea

© Stack Overflow or respective owner

Related posts about JavaScript