javascript – YUI: customizing message browser shows when cancelling window close event – Education Career Blog

I have a YUI application.
Under certain circumstances I want to alert the user before he closes the window.
Therefore I capture the window close event and do

onWindowClose: function(e) {
        if (...)
        {
            YAHOO.util.Event.preventDefault(e);
        }
    }   

The browser shows a standrd message: “Are you sure you want to navigate away from this page? Press OK to continue, cancel to stay in the current page”.

How can I customize the message the browser shows?

,

Check for onbeforeunload event and my answer in

show a message box when user close IE

and

ASP.NET: Warning on changed data closing windows

It may work for you.

Leave a Comment