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.
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.
js
new PopStateEvent(type, options)
type
A string with the name of the event. It is case-sensitive and browsers set it to popstate.
options Optional
An object that, in addition to the properties defined in Event(), has the following property:
state Optional
An object representing the state. Practically it is a value provided by the call to history.pushState() or history.replaceState(). If not set, it defaults to null.
A new PopStateEvent object.
| Specification |
|---|
| HTML Standard # the-popstateevent-interface |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
PopStateEvent |
16 | 14 | 11 | No | 15 | 6 | 4.4 | 18 | 14 | 14 | 6 | 1.0 |
© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/PopStateEvent/PopStateEvent