Extra caution is recommended when installing recently uploaded/updated scripts (read more)
Be sure you trust any scripts you install

Protect Textarea

Protect from closing or navigating away from a web page with changed textareas.






Nov 7, 2006
jeroenvrp User

This script doesn't work in Firefox 2 as it seems. I tested it with Wikipedia and a Joomla site. When I close the tab, there is no warning.

 
Oct 6, 2005
ankut Scriptwright
Just a comment regarding your question... the reason your addEventListener didnt work, is that you have to put the entire function body into that second argument of addEventListener. Putting a reference to your function will not work since it will go out of scope!

window.addEventListener('beforeunload', function(event){...}, true);

Just like that, and it should be fine.

You could comment on this script if you were logged in.