Shahin

Page Unload Event

Advanced
Updated Jul 11, 2026 Shahin editorial 2 min read
PronunciationEN/peɪdʒ ʌnˈloʊd ɪˈvɛnt/

A page unload event is the notification a browser fires when a page is being closed or navigated away from, which analytics tools use to send their final data.

The oldest forms are unload and beforeunload, both of which became unreliable on mobile: when a visitor switches tabs or closes the app, the operating system may discard the page without ever firing them. The recommended replacements today are pagehide and visibilitychange, which do fire on mobile and do not disqualify the page from the browser's back-forward cache. Sending data at that moment has its own problem, since an ordinary request can be cancelled as the page tears down, which is why the final payload is sent as a beacon that the browser keeps delivering after the page is gone. The practical consequence is that no tool knows the exact moment of departure, so metrics that depend on it, such as time on the last page, are always estimates.

Sources:MDN — Window: pagehide eventMDN — Navigator: sendBeacon() method