How to force Safari to warn before leaving a page when a form is filled in but not submitted

errorpluginssafarisettings

I used to see Safari (8, currently) warn about filled-in forms before navigating off a page.

I just lost a large writing twice due to accidental swipe on the trackpad/clicking, and had no warning, and when navigating back, the form was cleared (I also have seen before when Safari would retain the form information you'd typed when navigating back–why is this inconsistent?). I want to shoot myself in the face.

Rather than shoot myself in the face, I'd rather make this behavior like it should be. Is there a way to re-enable the warnings, and/or retaining what you've written, using settings, or is there a plug-in that can do this?

It seems like this has happened at least once to most people I know.

Best Answer

Try this in Terminal

defaults write com.apple.Safari DebugConfirmTossingUnsubmittedFormText -integer -1

Which seems slightly odd, as the opposite is -bool false but that's what "Secrets" shows for the 2 alternatives.
http://secrets.blacktree.com/edit?id=2467 ought to be the page with the defaults data for that, but the entire site is coming up 404 today.