How to make web page store data from user? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

How to make web page store data from user?

I've been experiencing with making little fun projects using HTML, CSS and JS. But everything loads back from the beginning each time the page reopens. Changes in the DOM caused by JS are also reversed. So how can I write a page where user can start from where they left off like a game that saves player data?

27th Feb 2019, 8:27 AM
Abraham N. Mulbah
Abraham N. Mulbah - avatar
9 Answers
+ 2
For private game data, I suggest you to use local storage. No reason to use server database for a such thing
27th Feb 2019, 9:32 AM
Toni Isotalo
Toni Isotalo - avatar
+ 2
Thanks Sham XR but does it have to work from a server? How about one that would be stored on user's device? If locally storing data is possible what language can help me achieve this?
27th Feb 2019, 10:56 PM
Abraham N. Mulbah
Abraham N. Mulbah - avatar
+ 2
use cookies in javascript
28th Feb 2019, 6:54 PM
Victor Rubba
Victor Rubba - avatar
+ 1
you need a database to do such a things, in terms of game development if you go deep inside it you will find many built in functions doing these things for you.
27th Feb 2019, 8:46 AM
Ahmad Ali
Ahmad Ali - avatar
+ 1
otherwise you Need a database to store all variables when the session closes, and load it again when we come back.
27th Feb 2019, 8:47 AM
Ahmad Ali
Ahmad Ali - avatar
+ 1
As mentioned before, you need a backend (database). Alternatively you can store the data in the browser (localStorage). When the user visits the site again, the data can be accessed from localStorage.
27th Feb 2019, 10:13 AM
wenz
wenz - avatar
+ 1
with the support of database we can store users info in a secure manner in java : JDBC and HIBERNATE in .Net : ADO.NET in PHP : several predefined functions in Python : there are modules ex pymysql
1st Mar 2019, 4:36 AM
sree harsha
sree harsha - avatar
+ 1
Im wondering just what is the real purpose of cookies ? and are they only utilized in javascript or all the language
2nd Mar 2019, 2:38 AM
Karmit Nostaw
Karmit Nostaw - avatar
+ 1
Use firebase local data base with xamapp intialize firebase it give you a local database using your Sql skill you can use it
5th Mar 2019, 8:41 PM
George S Mulbah II
George S Mulbah II - avatar