automatically post form when leaving page
<p>This is a plain javascript question.</p>

<p>I have a page C in which sits a textarea T.
T's content gets added to by clicks on various buttons on C (essentially T accumulates the list of times at which the buttons were clicked).</p>

<p>There is also a button to submit the contents of T by a post request to a server (T being surrounded by a form element).</p>

<p>When the user forgets to click the submit button and closes the page's window, I want the posting of T's contents to happen anyway, just as if the user had clicked the submit button before closing the window.</p>

<p>I know I can intercept the page closing and prompt the user to do the submit, but that is NOT what I want.</p>

<p>It seems to be impossible to submit the form containing T from inside a function that is called by onbeforeunload.</p>

<p>Thanks for any tip.</p>
