Instead of going the complicated way, why not have it as a feature based on group permission? Kind of like only allowing administrators or moderators, and contributors set up with the "Yes" permission to have "Autosave drafts" enabled, that way the administrator controls who has this ability and it won't be a major drain, you can implement a client-side autosave draft later on as part of this, depending on what the team would want.

But I would definitely like this feature seeing as I have accidentally closed my browser about 3 times posting long topics, but have since taken kin to hitting the save draft button, it would be nice to have something like what Google does for their e-mails or YouTube video edits, where it automatically saves.

Ooohh This topic has quite some time.
I think saving should be in the client side. We now have the LocaStorage interface, which is a simple key-value to store. We can just store there with a key we can decide to be wildly used in phpBB.
Each key-value table follows the same origin rules. This means that there's a different table available for each sub-domain, and such.
We may use some randomization with the keys to make sure that no clashes happen for multiple forums in the same domain/subdomain, anyway.
+ info:https://developer.mozilla.org/en-US/doc ... calStorage

Pony99CA wrote:Maybe it should be tied to events, not time or changes. For example, autosave when a Preview is done or when a Close Window event is fired.

That's not fast enough. The whole DOM may be gone before you can properly send the contents of the post.
I still think that using the LocalStorage interface seem to be one of the best approaches for this problem.

Right. That code would never work. And doing an alert, prompt or whatever can be ignored by the browser so, also no go.
On that event callback, the only real thing you can do is to manipulate the DOM to give different looks (some companies use it to show a modal window stating that the request is being processed) and to ask for a js popup asking if the user wants to stay or leave the page. Some browsers may allow other interactions but it's just because they wanted to.

Some questions that have cropped up: Do we need to keep track of more than one post at a time? It seems to me that a user will only be working on one post at a time per board. If we want to distinguish posts, how should they be uniquely identified? Forum and/or topic combo?

When do we clear autosave data? Can we rely on the 'post success' page to reliably delete the data before it redirects?

Update:
Decided on saving post data uniquely with the topic id and/or forum id (in the case of a new topic). Also the window creation time will be used in the case that a user opens multiple tabs in the same topic.

Some questions that have cropped up: Do we need to keep track of more than one post at a time? It seems to me that a user will only be working on one post at a time per board. If we want to distinguish posts, how should they be uniquely identified? Forum and/or topic combo?

When do we clear autosave data? Can we rely on the 'post success' page to reliably delete the data before it redirects?

Update:
Decided on saving post data uniquely with the topic id and/or forum id (in the case of a new topic). Also the window creation time will be used in the case that a user opens multiple tabs in the same topic.

I feel that it should tell the user as it saves.

Another approach would be to either save it fairly often (like every few seconds), or save it every time the user stops typing for a couple seconds. As you're saving it at the client side, it won't cost much, and the user won't notice.