Hello all,
Today I implemented a new PlaceManager that uses HTML5 pushState, rather than the GWT history API:
It treats the entire path/query string as the history token, and falls back to setting window.location if pushState is not available. It could easily be made to fall back to using the GWT history API, but in my view that defeats the biggest reason for using pushState(), that is, to allow proper URLs that can be easily maintained on the server (using redirects etc). If one browser has one representation, and another browser has another, then you no longer have maintainable URLs, so no reason to use pushState other than aesthetics.
By itself it works ok, but the following other things could be modified to make the usage of it even better:
* Modifications to the original PlaceManagerImpl so that handling a place request can be cleanly aborted when pushState is not available (so the browser will just handle the window.location request)
* It overrides a number of package private methods in PlaceManagerImpl, so must live in the same package as this. Inclusion in GWTP proper would be a much better solution.
To use it, simply make sure it lives in the com.gwtplatform.mvp.client.proxy package (so it can override the package private methods), and then bind it to PlaceManager.class, eg in a Gin module:
bind(PlaceManager.class).to(Html5PushStatePlaceManager.class);
So anyway, would be nice for this to be included in GWTP, GWTP isn't using GitHub or anything where I can submit a pull request yet is it?
Cheers,
James