A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developer.mozilla.org/en-US/docs/Web/API/PopStateEvent/state below:

PopStateEvent: state property - Web APIs

PopStateEvent: state property

Baseline Widely available

The state read-only property of the PopStateEvent interface represents the state stored when the event was created.

Practically it is a value provided by the call to history.pushState() or history.replaceState()

Value

An object, or null.

Examples

The code below logs the value of state when using the pushState() method to push a value to the history.

// Log the state of
addEventListener("popstate", (event) => {
  console.log("State received: ", event.state);
});

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

This will log:

State received: { name: "Example" }
State received: { name: "Another example" }
Specifications Browser compatibility See also

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.3