In modern web development, managing data on the client side has become an essential skill. Developers often rely on localStorage, sessionStorage, a...
For further actions, you may consider blocking this person and/or reporting abuse
One interesting thing to note with localStorage or sessionStorage is the “storage” event.
With this event, a browser tab (or window) can synchronize if the localStorage or sessionStorage is updated in another browser tab (or window).
Does this thing utilize "storage" event for the window animation syncing?
youtu.be/aKPkYY-CYuw
Yes, I think so, if you look at this project file.
The
storage
event only happens for local storage. This event is in direct contradiction to the definition of session storage.Yes, it is not possible to synchronize a tab or window with the storage event for sessionStorage, since sessionStorage is private to each tab or window.
However, the storage event is sent in certain cases for sessionStorage, for example if you modify sessionStorage using the browser's developer tools.
Nice read 👏
There is no usage of tags at the end.. just letting you know.
You might not know but there is a hooks system to use localstorage: mantine.dev/hooks/use-local-storage/
Not preferable to install a package but I thought it would be worth sharing here if anybody wants to check it out.
I know about that, but you have to install the Mantine UI library. then only you can use this hook. thanks for your feedback.
cookies need
decodeURIComponent
for likely both the key and their values ... please update the example code accordingly, or surprises will happen 👋The best explaination between the localStorage, sessionStorage and cookies..
very Impressive
Very well written! Even I could understand
I love this one! Recently, I faced a couple of issues with them. Thanks for sharing!
I'm out of storage for almost one year and struggling alot even with phone storage
Thanks for the explanation mate.
Thanks for the information ☺️
Nicely explained
Thanks
If writing about data storage for web why didn't you include serviceWorkers' cache and indexDB?
Thanks for the nice explanation.
Nicely explained
That's a great explanation; by the way, you can add syntax highlighting to the code blocks to boost readabilty.
Just change:
... to specify the language:
More details can be found here --> editor guide!
LocalStorage is used for persistent client-side storage, surviving across sessions, while sessionStorage is temporary and only lasts for a session. Cookies store small data sent with HTTP requests, with configurable expiration. The post above provides examples and guidance on when to use each, such as storing user preferences or authentication tokens... Just summarized all of that for ya 😈
Thank you in information technology
thanks for your effort. It's amazing.
In the past I used localstorage, but after reading this article, I recognized my fault.
I'm waiting for your next articles.
nice
It might be a good idea to point out that both localStorage are limited to a single host (URL). Therefore if you want/need to share information to multiple URL, port, domain. You must use cookie.
Thank you for sharing the valuable information
amazing , thank you
Great summary of web storage options! This will be really helpful for beginners. Maybe also consider adding a note about IndexedDB for more advanced storage needs. Thanks for sharing! 👏
What about redis? @abhay1kumar