+ 1
LocalStorageSessionStorage
Can someone give me a better explanation of local and session storage is there an example code that i can see??
12 Answers
+ 1
Think of localStorage in the same way that you think of cookies. It's data stored on your end and can persist between sessions. Whereas a session is only for that session and is gone when you close the page.
Personally, I don't recommend storing your password or any critical data in either. However, you can certainly store an ID that's given to the user after they log in, or something like that. Keep your passwords / personal data stored in database and make sure pass is encrypted. When you go to log in, have your server-side scripting check inputted password against the database, and if its correct, return the other data to set up the session for logged in user. You can have it create and set a unique key in the database for the user when it's confirmed they used correct password; that'll help keep people from being able to spoof the ID for a particular user.
+ 2
lolol Nice username. :D Just noticed it.
Anyways, localStorage lets you save data and retrieve it. It stays until you delete it. The sessionStorage is going to store it for that WINDOW until the window is no longer in existence (you close it).
Hope that helps.
+ 2
haha thxs anyways is this used to save passwords and emails that people input into the website.if so..how do you see the info after??
+ 2
Have you learned any server-side programming langs (PHP/ASP/Node) and SQL yet? If not, go read those and it'll start making more sense. lol
+ 2
im learning html5 thats why..
+ 2
Gotcha. HTML best place to start with it all. :) Just take note of it in your head for now, and keep pushing through HTML. When you're done with HTML, I'd recommend reading through CSS3 and JavaScript next. Then read one of the JS frameworks, such as jQuery or AngularJS. Then learn PHP and MySQL. By that point, it'll all make sense to ya. It doesn't take as long as it sounds to learn all of that. lol
Best of luck to you bro!
+ 2
You're more than welcome bro. Don't hesitate to post up any questions you have. I'm not the best person to explain things, but there are a lot of amazing people here willing to help out.
+ 1
wow......im confused
+ 1
i dont wanna bug you but.....
+ 1
thxs
+ 1
k