Skip to content

recommend against using unload event #3469

Open
@fergald

Description

@fergald

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions