Detect unsaved changes before navigating away from page

Hi, I have a form on a default layout page with a button where users can manually save changes. But what if the user navigates away from the page, then any changed values will not be committed. I came up with the idea to use the java action ObjectHasChanged in any microflow connected to a button that navigates away from the page. In this way I can warn the user with a pop up if they wish to continue. But I have a problem when users click on an item in the navigation menu, because no parameters are allowed in microflows called from navigation items.  So how to automatically detect unsaved changes and warn the user? Any help is very much appreciated. 
0 answers