This page demonstrates the goog.History object which can create new browser history entries without leaving the page. This version uses the hash portion of the URL to make the history state available to the user. These URLs can be bookmarked, edited, pasted in emails, etc., just like normal URLs. The browser's back and forward buttons will navigate between the visited history states.
Try following the hash links below, or updating the location with your own tokens. Replacing the token will update the page address without appending a new history entry.
Set #fragment
first
second
third
Set Token
The current history state: |
The state should be correctly restored after you leave the page and hit the back button.
The history object can also be created so that the history state is not user-visible/modifiable. See history2.html for a demo. To see visible/modifiable history work when the goog.History code itself is loaded inside a hidden iframe, see history3.html.