Skip to content

Commit cf3515a

Browse files
Remove outdated statement that browsers tend to handle the popstate event differently on page load (mdn#43373)
* Update popstate event handling details mdn#43368 Updated the section on the handling of popstate event on page load across different browsers. Closes mdn#43368 * Update files/en-us/web/api/window/popstate_event/index.md Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Remove outdated information about popstate event handling on page load. based on review comment mdn#43373 (review) --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent ac0fef0 commit cf3515a

File tree

1 file changed

+0
-2
lines changed
  • files/en-us/web/api/window/popstate_event

1 file changed

+0
-2
lines changed

files/en-us/web/api/window/popstate_event/index.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ These methods and their corresponding events can be used to add data to the hist
4747

4848
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).
4949

50-
Browsers tend to handle the `popstate` event differently on page load. Chrome (prior to v34) and Safari always emit a `popstate` event on page load, but Firefox doesn't.
51-
5250
> [!NOTE]
5351
> When writing functions that process `popstate` event it is important to take into account that properties like `window.location` will already reflect the state change (if it affected the current URL), but `document` might still not. If the goal is to catch the moment when the new document state is already fully in place, a zero-delay {{domxref("Window.setTimeout", "setTimeout()")}} method call should be used to effectively put its inner _callback_ function that does the processing at the end of the browser event loop: `window.onpopstate = () => setTimeout(doSomeThing, 0);`
5452

0 commit comments

Comments
 (0)