Warn or prevent unsaved changes

Put up a warning when attempting to move away from the page in the browser when there are unsaved changes on a form or table?

Retool does this when editing queries, but it would be a great feature when using the app which I don't believe it does and I can't think how I could implement this?

Thanks

Jeremy

Use onBlur?
The onblur event occurs when an object loses focus . The onblur event is most often used with form validation code (e.g. when the user leaves a form field).