Back to Wails

History API Demo

v3/examples/web-apis/history/frontend/index.html

2.13.01.4 KB
Original Source

History API Demo

The History API allows manipulation of the browser session history, enabling single-page applications (SPAs) to update the URL without full page reloads.

History API: checking...

Current State

URL:--

history.state:

null

0

History Length

0

pushState Calls

0

replaceState Calls

0

popstate Events

← Back Forward →Go -2Go +2

Note on Navigation

The back/forward buttons use history.back() and history.forward(). You can also use history.go(n) to jump multiple entries. Navigation will trigger the popstate event.

Simulated SPA Navigation

Click pages below to navigate. The URL updates without a page reload.

HomeProductsAboutContactSettings

🏠

Home

Welcome to the home page

pushState

Add a new entry to the browser history. This does not reload the page.

URL Path

State Data (JSON)

Title (mostly ignored by browsers) pushState

replaceState

Replace the current history entry. Does not create a new entry.

URL Path

State Data (JSON) replaceState

History Stack (Local Tracking)

Note: The History API does not provide access to the full history stack for privacy reasons. This list tracks only entries created during this session.

Clear Local Tracking

0--

Loading...

state: null

API Support

Event Log

Clear Log History events will be logged here... Use the controls above to manipulate history and see events logged.