What is Web Storage?
Turkish: Web Storage (localStorage/sessionStorage)
Web Storage stores small key-value data in the browser through localStorage and sessionStorage for client-side state.
What is Web Storage?
Web Storage is a browser API family for storing simple key-value data. Its two common parts are localStorage and sessionStorage.
localStorage keeps data until the user or application clears it. sessionStorage usually lasts for the lifetime of a browser tab. Both are read and written through JavaScript, and values are stored as strings.
Difference from Cookies
A cookie can be sent to the server with every HTTP request. Web Storage is not automatically attached to requests; it is mostly used for client-side preferences, temporary UI state, or small caches.
That difference makes Web Storage simpler in some cases, but it does not remove security responsibility. If a page has an XSS vulnerability, malicious JavaScript can read this data.
Business Use and Limits
Theme preference, language selection, dismissed banners, draft form fields, and filter settings are good examples for Web Storage. Access tokens, passwords, identity documents, and payment data should not be stored there.
For larger, indexed, or offline data needs, IndexedDB is usually the better choice.
Related Terms
A cookie is a small browser-stored value tied to a domain, used for sessions, preferences, consent, and limited tracking.
IndexedDBIndexedDB is a browser database for storing large structured data persistently with indexes and asynchronous access.
JavaScriptJavaScript is a dynamic programming language that runs in web browsers and is used to create interactive web interfaces.
SessionA session links a user's identity and temporary state across requests in a web application, using server-side or client-side storage.