Help with storing user Data

Hi everyone, hope the coding is going well. I'm at the part of my website where I need to store use data. Would that be stored in local storage, or local and session storage?
5 Replies
ishto
ishto11mo ago
If you are gonna use them when the users opens the website again then local and if you dont care after the user leaves, session
13eck
13eck11mo ago
Local/season storage is an either/or thing. You use one or the other, not both. Session storage keeps the data until the user closes the browser. Local storage laps the data into you or they delete it.
Stan Long
Stan LongOP11mo ago
Ok, I think Local is what I'd prefer, because what I'm trying to do save a login info that I'll use to create a profile based on what they chose on the website is there a storage limit to local storage? Because I don't want my user login info to plug things up
13eck
13eck11mo ago
According to MDN there's a 5MiB (5_242_880 bytes) storage limit per origin. Also keep in mind that local storage only stores strings, not any other type of data. a 5MiB string is gonna be long. Longer than you should ever need for user data. You'll need, what, a display name, a user ID, possibly some permissions (most likely a stringified bitflag number) and potentially a URL for an avatar. No where near 5MiB of data!
Stan Long
Stan LongOP11mo ago
In this case I only need to store login info, and their clicks for a couple of buttons. It's a very low amount of data that'll be stored
Want results from more Discord servers?
Add your server