Skip to content

recommend against using unload event #3469

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
fergald opened this issue Jun 1, 2023 · 0 comments
Open

recommend against using unload event #3469

fergald opened this issue Jun 1, 2023 · 0 comments

Comments

@fergald
Copy link

fergald commented Jun 1, 2023

Currently this article recommends using the unload event to close popups and send stats. unload cannot be relied upon and best practice is to avoid it entirely, using pagehide or visibilitychange.

E.g. popups should be closed in pagehide, not unload because a page that canenter BFCache will not fire unload but will fire pagehide

Stats should not be sent from unload because if the page goes into BFCache and the user never returns, the unload event will never fire.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant