tags:

views:

87

answers:

2

I've divided my GWT app into multiple modules, what's the best way to navigate between them?

Currently I'm using Window.Location.assign("foo.html#bar") but is there a better way?

A: 

History.newItem( "bar" ) has the same effect, and you don't even need to know the URL.

Ashwin Prabhu
This will only work in on the current module which is not what KevMo is asking for
Maksim
+2  A: 

History.newItem only works for history within the current module. To change to another page I think the best way is to use Window.Location.assign.

I don't fully remember the issue (and perhaps it has been fixed now), but in our application we stopped using relative URLs as they would sometimes break (we have a comment referencing http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/f79e7d5e002b48f6).

To this end we had a method that did the following:

public void goToRelativePage(final String relativeURL) {
  Window.Location.assign(GWT.getHostPageBaseURL() + relativeURL);
}
Martin Hutchinson