Localstorage Sessionstorage Cookies
Localstorage Sessionstorage Cookies
sessionStorage
cookies
localStorage
localStorage.removeItem('greeting');
sessionStorage
sessionStorage.removeItem('greeting');
cookies 🍪
persistent in browser memory.
inaccessible with JavaScript (with the HttpOnly flag).
automatically sent to the server during an HTTP request.
Authentication data stored with localStorage or sessionStorage are
vulnerable to cross-site scripting XSS attacks.
cookies when used with the HttpOnly flag are not accessible with
JavaScript and are thus immune to XSS attacks.
cookies when used with the Secure flag ensure cookies can only be sent
securely through HTTPS.
Cookies are vulnerable to cross-site request forgery CSRF attacks.
SameSite
XCSRFTOKEN