pushState does NOT fire popstate #30178
Labels
Content:WebAPI
Web API docs
needs triage
Triage needed by staff and/or partners. Automatically applied when an issue is opened.
MDN URL
https://developer.mozilla.org/en-US/docs/Web/API/History/pushState
What specific section or headline is this issue about?
History: pushState() method
What information was incorrect, unhelpful, or incomplete?
The page says: "Add a listener for the popstate event in order to determine when the navigation has completed. The state parameter will be available in it."
Yet the popState page (https://developer.mozilla.org/en-US/docs/Web/API/Window/popstate_event) says: Note that just calling history.pushState() or history.replaceState() won't trigger a popstate event. The popstate event will be triggered by doing a browser action such as a click on the back or forward button (or calling history.back() or history.forward() in JavaScript).
_
What did you expect to see?
I'd expect it to say e.g. "You cannot listen for state changes using popstate, so maybe you should reconsider your entire approach."
Do you have any supporting links, references, or citations?
No response
Do you have anything more you want to share?
No response
MDN metadata
Page report details
en-us/web/api/history/pushstate
The text was updated successfully, but these errors were encountered: