If losing your not-saved work is the primary concern, you can also look into using Local Storage to save the work that hasn’t been submitted yet. I use that on an app and the user can accidentally close the tab and reopen the app and be exactly where they were, no work lost.