Opens in a new tab
A picture of Jeff Brigman
I CODE TODAY FOR
A BETTER TOMORROW

Glossary Term

History.pushState()

3 tags 1 category

The pushState() method of the History interface adds an entry to the browser’s session history stack.

In a sense, calling pushState() is similar to setting window.location = “#foo”, in that both will also create and activate another history entry associated with the current document. But pushState() has a few advantages:

The new URL can be any URL in the same origin as the current URL. In contrast, setting window.location keeps you at the same document only if you modify only the hash. Changing the page’s URL is optional. In contrast, setting window.location = “#foo”; only creates a new history entry if the current hash isn’t #foo. You can associate arbitrary data with your new history entry. With the hash-based approach, you need to encode all of the relevant data into a short string.

Term Connections

Explore related terms connected by shared tags, shared categories, and relationship phrases. This map loads only when it comes into view.

Loading term connections…