Prevent exiting a user input page if there are unsaved changes

Does anyone have a simple solution to making sure that a user does not leave a page with unsaved changes to input fields?

Any help or direction appreciated.

#unsaved_changes #user_navigation #user_input

Dave, short answer: no. Longer one: I set a global isDirty boolean on every onChange event for every field. Once people press my on screen Back-button or click on another menu item (so all within the environment you control), you can pop up a message is the flag is set. But …: if user closes the browser tab, the browser itself ot presses the browser´s back button (=all outside the environmet of your control), then there is nothing you can do.

Thanks, Giri. Kind of figured the back button was out bounds for a solution, but your approach sounds reasonable. Thanks for the suggestion.