Sorry that would be $wnd.location as in the code... I am at a loss as to how to fix this!
On Nov 4, 10:53 am, Andy_W <[email protected]> wrote: > Hi, > > I have the following code to prompt the user that if they navigate > away "bad stuff" could happen: > > /** > * Adds a handler to show warning when page is being closed. > */ > private void addCloseHandler() { > Window.addWindowClosingHandler(new Window.ClosingHandler() { > > public void onWindowClosing(ClosingEvent event) { > event.setMessage("Bad Stuff might happen"); > } > }); > > Window.addCloseHandler(new CloseHandler<Window>() { > > public void onClose(CloseEvent<Window> event) { > //Cleanup > } > }); > } > > If I manually type a new URL into IE6/7/8 such aswww.google.com, the > prompt appears, and if the user clicks cancel, the redirect does not > occur as expected. > > However, I have a logout button that logs the user out, and then does > a simple $wnd.location="some url". When this is pressed, the popup > appears as before and warns the user, but regardless of whether the > user clicks ok or cancel, they are always logged out and redirected. > This does not happen in Chrome or Firefox which work exactly as > expected (surprise!). > > The code for this is below: > > public static void doLogout() { > RequestBuilder rb = new RequestBuilder(RequestBuilder.POST, > GwtUtils.getServerUrl() > + "/mywebsite?action=doLogout"); > try { > > rb.sendRequest("", new RequestCallback() { > public void onError(Request request, > Throwable exception) { > > //do something > } > > public void onResponseReceived(Request > request, Response response) > { > GwtUtils.redirect(getLogoutUrl()); > } > > }); > } catch (RequestException e) { > DebugUtils.addDebugMessage("Exception logging out", > e); > GwtUtils.redirect(getLogoutUrl()); > } > > } > > And in my GetUtils class I have the following Native method: > > public static native void redirect(String url)/*-{ > $wnd.location = url; > }-*/; -- 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.
