autosave pattern
- by Mark
I'm using localstorage to do gmail-style autosave on a webpage.
So I basically save every 30 seconds to local, OK.
The problem is recovery. I can't detect whether or not a user has crashed or incorrectly exited.
So let's say the user crashed and loads up the form again, I can't just continue saving and overwriting the previous autosaves. I need to restore the previous save.
But let's say the user didn't crash. He did everything correctly, but then used a different browser to edit the same file, so no new data to the previous browser's localstorage.
He then loads up the file in the previous browser. The localstorage should not be restored in that case.
Assuming there's no way to compare timestamps, how can I solve this problem?
Thanks.