[ Web Proxy ]
URL:
Viewing: https://developer.mozilla.org/ko/docs/Web/API/History/state [Back]  [Original]

History.state - Web API | MDN

This page was translated from English by the community. Learn more and join the MDN Web Docs community.

View in English Always switch to English

History.state

Baseline
Widely available

This feature is well established and works across many devices and browser versions. Its been available across browsers since 2015 7.

History.state history state .

popstate state .

In this article

js
const currentState = history.state;

history . pushState() replaceState() null .

history.state pushState() State .

history.state .

js
// Should be null because we haven't modified the history stack yet
console.log(`History.state before pushState: ${history.state}`);

// Now push something on the stack
history.pushState({ name: "Example" }, "pushState example", "page3.html");

// Now state has a value.
console.log(`History.state after pushState: ${history.state}`);

Specification
HTML
# dom-history-state-dev


Web Proxy Viewer  |  New URL  |  Original Page