Local Storage
Local Storage
Cookies
Local storage
Session storage
LOCAL STORAGE
WHAT IS LOCAL STORAGE?
Local storage is a property that allows JavaScript sites
and apps to save key-value pairs in a web browser with
no expiration date. This means the data stored persists
even after the user closes the browser or restarts the
computer.
WHEN TO USE LOCAL STORAGE ?
Local Storage store user preferences, like language or theme.
You can also use it to cache data if you use it frequently.
localStorage can store form data that won't be lost if the user
closes the browser.
If you have an application that requires you to log in, localStorage
can be used to keep your session data.
METHODS OF LOCAL STORAGE
setItem(key, value) – store key/value pair.
getItem(key) – get the value by key.
removeItem(key) – remove the key with its value.
clear() – delete everything.
key(index) – get the key on a given position.
length – the number of stored items.
ADVANTAGES OF LOCAL STORAGE
Data security: Users have complete control over their data and storage
infrastructure, which can be important for security and regulatory reasons.
Offline access: Local storage allows users to access their data offline.
Local storage is best for information that doesn't need to be very secure and
is not large in size. However, putting too much data into local storage can
slow down a site due to memory consumption.
DISADVANTAGES OF LOCAL
STORAGE
Not supported by older browsers: Older browsers may not support local
storage.
Data loss: Local storage can be lost if the user clears their browser data
or if the hardware fails.
Not accessible by the server: The server can't access local storage.
THANK YOU