mj527
mj527

Reputation: 161

Detecting refresh event in 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

Upvotes: 7

Views: 3198

Answers (1)

helpermethod
helpermethod

Reputation: 62145

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.

Upvotes: 8

Related Questions