TheFragebogen / TheFragebogen

A standalone questionnaire system that only requires a HTML5-capable web browser.
http://www.TheFragebogen.de
MIT License
9 stars 5 forks source link

Storing a questionnaire's progress in HTML5's local storage #1

Open dennisguse opened 7 years ago

dennisguse commented 7 years ago

At the moment, TheFragebogen does not store it's progress persistently. Thus, closing the web page will result in a loss of all so far gathered data. This issue might be avoided to a certain degree by storing the data at a regular interval. However, continuing a questionnaire is not easily possible using this method.

It would be nice to persistently store the current progress (incl. gathered data) in HTML5's local storage [1]. On start, TheFragebogen can check if their is stored data available and if it's fits to the questionnaire (ie. data is in line with the loaded configuration). If so the data can be restored and TheFragebogen would continue from the last stored data point.

Support for serializing and de-serializing should be already implemented for nearly all components of TheFragebogen using the getData()-method and setData()-method after an object was created.

[1] https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API

dennisguse commented 5 years ago

Actually, this feature was already implemented in a one of the earliest prototypes. getData() and setData() are "leftovers".

dennisguse commented 5 years ago

NOTE: be careful to inform the user that data is stored in local storage! The API does not support an expiration date and thus might be there for a very long time. This might also expose sensitive data - depending on the collected data.

Moreover, outdated data (not fitting to the current questionnaire) needs to be considered. What to do about it?

in general suggested reading: [https://dev.to/rdegges/please-stop-using-local-storage-1i04] (https://dev.to/rdegges/please-stop-using-local-storage-1i04)