Write browser location declaratively

A location-element with method and src writes the page URL. Supported methods mirror location.href, location.hash, location.assign(), location.replace(), history.pushState(), and history.replaceState().

Render a writer only in response to deliberate state or an event. A writer whose target already equals the current URL is inert, preventing duplicate history entries. An optional trigger token runs a command only when that token changes; an empty token does nothing. These examples use the event slice's revision, so typing a draft or observing someone else's navigation cannot reapply the previous command.

See also

Read current and explicit URLs

Slice declarations and event bindings