I'm trying to replicate the same thing as on the stackoverflow textareas.
EDIT: I went with something like this, after reading the suggestions here:
window.onbeforeunload = function()
{
var myTextArea = document.getElementById('post_content');
if (myTextArea.value.length > 0)
{
return "You haven\'t submitted your post; are you sure you want to discard it?";
}
}
This seemed to work with Firefox and other browsers without causing double confirmations.