Web APIs
History.replaceState()
Replaces the current history entry state; the optional URL must satisfy document rewrite restrictions.
Formal Syntax & Structure
javascript syntaxjavascript
history.replaceState(state, unused, url?)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| state | any | Serializable state. |
| unused | string | Legacy argument, normally empty. |
| url | string | null | Optional rewritten URL. |
Return Value
undefined
No return value.
Working Example
Example Snippetjavascript
(async () => {history.replaceState({page:2},"");console.log(history.state.page);})()