Conformation box on Browser Close

Need to get a confirmation box when a browser gets closed …Anyone please help me on this …

I tried the below one but the Browser closes before any action is done

final Window win = new Window(windowName) {
@Override
protected void close() {
if(closable)
{
super.close();
}
else
{
getWindow().showNotification(“Window closed by user”,Notification.TYPE_WARNING_MESSAGE);
}
};
};
Can some one help on how i can resolve it … or can suggest me an alternate solution for this .

Lemme knw if you get a solution for this

See
this thread
.