java - Confirm Browser Exit in GWT -


this question has answer here:

i want display confirmation dialog when users tries leave gwt application. if user chooses stay in app, nothing done otherwise application should first send logout request server before closing.

how can that?

which handler use?

window.addclosehandler

or

window.addwindowclosinghandler

based on methods has, addwindowclosinghandler seems need.

edit: think need is... addwindowclosinghandler called when window closing, i.e. when user clicks close or reload button. addclosehandler called when window closes. use both! use closing handler display confirmation dialog, use close handler stuff want on close.

    window.addwindowclosinghandler(new window.closinghandler() {         @override         public void onwindowclosing(closingevent event) {             event.setmessage("do wanna close?");             system.out.println("closing...");         }     });      window.addclosehandler(new closehandler<window>() {         @override         public void onclose(closeevent<window> event) {             system.out.println("closed!");         }            }); 

Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -