Web platform features explorer

Beforeunload

Limited availability
Tags: api

The beforeunload event is fired when the current window is about to be unloaded. Typically this is used to display a dialog to confirm if users really want to leave the page when there is unsaved data that would be lost.

Learning resources on MDN

Browser support

Baseline availability blocked since July 2015 by Safari on iOS (117 months)