问题
i am new in gwt . I want when a user press back button he get a alert that page will we refresh .mostly we see during typing on loose focus if user press back button his page get refresh and all value goes wash. how can we achieve this..
回答1:
Try Window#ClosingEvent
Window.addWindowClosingHandler(new ClosingHandler() {
    @Override
    public void onWindowClosing(ClosingEvent event) {
        event.setMessage("Message");
    }
});
Please have a look at promt user on backspace and browser backbutton in gwt where I have mentioned other ways also.
For more info have a look at below posts:
- GWT back button browser
 - Best way to detect browser closing/navigation to other page and do logout
 
Snapshot:
    回答2:
this will work but result is same
  RootPanel.get().addDomHandler(new KeyUpHandler() {
    @Override
    public void onKeyUp(KeyUpEvent event) {
        if (event.getNativeKeyCode() == KeyCodes.KEY_BACKSPACE) {
            event.preventDefault();
        }
    }
}, KeyUpEvent.getType());
    来源:https://stackoverflow.com/questions/23225387/how-can-i-get-a-prompt-on-url-change