Warn the user that his action will log him out, or whatever. Like
this, using a WindowClosingHandler:
Window.addWindowClosingHandler(new Window.ClosingHandler(){
@Override
public void onWindowClosing(ClosingEvent event) {
event.setMessage("If you leave or refresh this page, " +
"you will be logged out of " +
"this application. Confirm that you want to do that.");
});
The browser will take it from there.
On May 28, 2:42 pm, Mike J <[email protected]> wrote:
> Hi,
> I ran into a problem about clicking the "reload" button on a web
> browser.
>
> My app is a stateful GWT app. Users need to be authenticated for
> login. After login they can surf on various pages. But users sometimes
> were used to press the "reload" button on the browser to refresh the
> page.
>
> The reloading process just bring the screen back to a reboot state,
> with all state info lost. That's not what we expect.
>
> The quick solution is, catch the reload event before the browser
> sends the "reload" request to the web server and prevent the browser
> from sending it.
>
> I have read the relevant posts in this group and found the useful
> info that "reload" event is equivalent to the Window Closing event. So
> in the following code snippet I can catch the event,
>
> Window.addCloseHandler(new CloseHandler<Window>() {
> public void onClose(CloseEvent<Window> event) {
> //prevent browser sending the reload request to the
> web browser
> }
> });
>
> But I don't know how I can stop the browser from sending the
> "reload" request to the web server.
>
> Thanks for any help,
>
> Mike J.
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.