flybywire
flybywire

Reputation: 273582

YUI: customizing message browser shows when cancelling window close event

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?

Upvotes: 1

Views: 1253

Answers (1)

lakshmanaraj
lakshmanaraj

Reputation: 4175

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.

Upvotes: 1

Related Questions