0

When I start writing a question on Stackoverflow without finishing, I can leave the page, and when I return the input still is keeping what I had entered. How can this be done? Is a database absolutely necessary?

I would like to do something similar for a small webapp. Its a question-app where users answer questions with "No"/"Maybe"/"Yes". Depending on the answer, different points are awarded. When the user quits the test and returns, I would like to be still able to return the results of the last time he used it.

Can this be done completely in JavaScript?

What the test looks like

TMOTTM
  • 3,286
  • 6
  • 32
  • 63

2 Answers2

2

You can store persistent information in localStorage - which is obviously local on the computer they're using.

Reference: https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage

Jamiec
  • 133,658
  • 13
  • 134
  • 193
0

If you want this to across many systems/browser, you should use Database and store results and get back when access again.

If this feature restricted to the browser that you logged in, browsers localStorage alone will do the job.

Can this be done completely in JavaScript?

Yes if you are using localstorage.

Ayush Gupta
  • 8,716
  • 8
  • 59
  • 92
Suresh Atta
  • 120,458
  • 37
  • 198
  • 307