+1 for the idea!
(I know Closure has it, and the HTML5 History API has a replaceState in
addition to pushState; and there's been a few requests on the forum to
add this feature to GWT)
There *will* be a need to override nativeReplace, at least in
HistoryImplIE6.
Also, I haven't checked but I'm not sure whether newItem("") end the URL
with a # or removes the hash part completely (and it might be a
different behavior in different browsers: HistoryImplMozilla explicitly
ends the URL with '#' to work around a bug; it might be worth checking
if the bug is still there, and if that's not the case, in which version
of Firefox it was fixed, maybe the nativeUpdate override in
HistoryImplMozilla is no longer necessary)
Finally, when this is done, please add a replace() (or goTo(Place
newPlace, boolean replace) to PlaceController too. It will be a breaking
change as PlaceHistoryManager.Historian would have to be amended with a
new method, but I don't think it'll affect many developers .
http://gwt-code-reviews.appspot.com/1614809/diff/1/user/test/com/google/gwt/user/client/ui/HistoryTest.java
File user/test/com/google/gwt/user/client/ui/HistoryTest.java (right):
http://gwt-code-reviews.appspot.com/1614809/diff/1/user/test/com/google/gwt/user/client/ui/HistoryTest.java#newcode213
user/test/com/google/gwt/user/client/ui/HistoryTest.java:213:
History.forward();
According to HTML5, doing a location.replace() will remove all the
following entries in the history, so you can no longer go forward.
See http://dev.w3.org/html5/spec/history.html#dom-location-replace which
redirects to http://dev.w3.org/html5/spec/history.html#navigate which in
this case redirects to
http://dev.w3.org/html5/spec/history.html#scroll-to-fragid
http://gwt-code-reviews.appspot.com/1614809/
--
http://groups.google.com/group/Google-Web-Toolkit-Contributors