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.