Wednesday, September 22, 2010

Go Homepage (1/2)

In my project, when the user exists the page must redirect to the
browser homepage.
I've developed this code, but It doesnt' work

//////////// CODE ON MY GWT COMPOSITE

Button btGoHome = new Button("Exit", new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
// I must call a logout method on server

((LoginServiceAsync)GWT.create(LoginService.class)).logout(new
AsyncCallback<Void>() {
public void onFailure(Throwable throwable) { }

public void onSuccess(Void aVoid) {
goHome();
}
});
}
});

public static native void goHome() /*-{
if (window.home){
window.home();
}else{
window.location = "about:home";
// For IE8, here it is the () solution
// http://stackoverflow.com/questions/1467115/internet-explorer-8-navigate-to-users-home-page
}

}-*/;

//////////////END CODE

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment