What you can do is one UrlManager:
public class UrlManager implements ValueChangeHandler<String> { public UrlManager() { History.addValueChangeHandler(this); } public void onValueChange(ValueChangeEvent<String> event) { String historyToken = event.getValue(); } }
Save each history token in a list.
If this is a brand new history marker, add it to the list. If this is the previous history token, the back button has been pressed.
I suggest using a list to save tokens and save an iterator that can move up and down the list. Therefore, it initially points to the end of the list. If the new token is the previous item in the list, then the "Back" button is pressed. If you are in the middle of the list (several times back) and a new entry appears (a new link is clicked), delete the rest of the list (you can no longer go there) and add new ones and move the iterator to this element.
You get the idea.
source share