GWT history delete item

Is it possible to delete a story item in gwt? I want to make sure that in a special case, pressing the browser return button displays the second story item from the back. I know that I can do this by manually calling History.back ();, but I don’t like it because the user will see a transition for a second or so, which is not nice. Thanks in advance for your help.

Cook

+4
source share
3 answers

No, browsers do not allow this.

GWT uses Javascript (of course) to manage browser history. Javascript engines do not allow deleting history entries.

You may be able to make a HistoryListener to skip the step you want to delete, but you will have to track the history yourself to decide which way to skip (forward or backward)

+7
source

As stated above, this is not possible with GWT, but you can control it using History

(note: HistoryListener mentioned in a previous post is deprecated)

Here is a simple example to get you started.

public class UrlManager implements ValueChangeHandler<String> { public UrlManager() { History.addValueChangeHandler(this); } public void onValueChange(ValueChangeEvent<String> event) { String historyToken = event.getValue(); } 

}

0
source

You can use History.replaceItem (newToken, fireEvent).

This will replace the current history token on top of the browser history stack.
newToken - token to replace the current top record
fireEvent - boolean for whether you want to trigger a history state event or not

0
source

All Articles