Skip to content

Avoid unload event listeners #5323

@adrienmaloba

Description

@adrienmaloba

Description

Hello,

When I run a speed test for my site, I see among the test results this warning of type "Avoid unload event listeners".

The warning : The unload event does not fire reliably and listening for it can prevent browser optimizations like the Back-Forward Cache. Use pagehide or visibilitychange events instead.

On checking, I found that the warning comes from my jQuery file version v3.6.0 or version v3.7.1. The source of the warning is https://github.com/jquery/jquery/blob/main/src/event.js#L125

Note: https://web.dev/bfcache/?utm_source=devtools#never-use-the-unload-event

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