+ 1
localstorage is almost like cookies (main use cases: storing user infos accross sessions, as ui style preferences, form data, backup values to be retrieved if unexpected close of page occurs...) Keys differences: * localstorage is limited to client-side scope while cookies are send to server with almost all request * localstorage provide more stockage space than cookies, but it still limited (around 5 to 10 Mo, depending on browsers, to be roughly divided by 2 as js string are utf-16 encoded/stored) * localstorage is newest than cookies (Html5 specs vs quite always), so api is easiest to use, but potentially not supported (for today really old devices/browsers) .
1st Jan 2021, 9:09 PM
visph - avatar