PopStateEvent: PopStateEvent() constructor
Baseline
Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since August 2016.
The PopStateEvent() constructor creates a new PopStateEvent object.
Note:
A web developer doesn't typically need to call this constructor, as the browser creates these objects itself when firing popstate events.
Syntax
new PopStateEvent(type, options)
Parameters
type-
A string with the name of the event. It is case-sensitive and browsers set it to
popstate. optionsOptional-
An object that, in addition to the properties defined in
Event(), has the following property:stateOptional-
An object representing the state. Practically it is a value provided by the call to
history.pushState()orhistory.replaceState(). If not set, it defaults tonull.
Return value
A new PopStateEvent object.
Specifications
| Specification |
|---|
| HTML> # the-popstateevent-interface> |
Browser compatibility
Loading…