Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detecting refresh event in GWT

Tags:

gwt

We need to detect the Refresh event (f5) / reload of the web application. Is there an event in GWT that can detect this?

thanks, mj

like image 257
mj527 Avatar asked Jun 15 '11 11:06

mj527


1 Answers

Add a Window Closing Handler:

HandlerRegistration registration = Window.addClosingHandler(new ClosingHandler() {
    void onWindowClosing(ClosingEvent event) {
        // call the server, or whatever
    }
});

EDIT

The HandlerRegistration is used to deregister the Handler if you don't need it anymore.

like image 145
helpermethod Avatar answered Sep 17 '22 23:09

helpermethod