Unsaved Changes - Detect page exit or reload

Is there an easy way to inform user of leaving page if there are unsaved data on form?


But this event is binded to routing subsystem. If user accidentally clicks back, there is no beforeLeave event.

We are using the UnloadObserver from SuperFields - Vaadin Add-on Directory

This also detects if the user closes the browser tab/window

Back button in the browser (to another Vaadin view) is also working