Skip to content

Unload event does not support bfcache #3

@RitikJaiswal75

Description

@RitikJaiswal75

Use visibilitychange event instead of unload event

Reason: the unload event is incompatible with the back/forward cache

Some browsers, such as Firefox, handle this incompatibility by excluding pages from the bfcache if they contain unload handlers, thus hurting performance. Others, such as Safari and Chrome on Android, handle it by not firing the unload event when the user navigates to another page in the same tab.

unload event does not fire on mobile browsers

Unload can be used in case of internet explorer but that does not support beacon.

reference: https://developer.mozilla.org/en-US/docs/Web/API/Navigator/sendBeacon#sending_analytics_at_the_end_of_a_session

solution:
image

image

image

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