|
Notices |
![]() |
|
Thread Tools | Rate Thread | Display Modes |
![]() |
#1 |
Registered User
Join Date: Mar 2014
Posts: 86
|
What is the difference between local storage and cookies?
Hello friends i want to know What is the difference between local storage and cookies?
|
![]() |
![]() |
![]() |
#2 |
Registered User
Join Date: Feb 2016
Posts: 83
|
[B]Cookies[/B
Pros: Legacy support (it's been around forever) Persistent data Expiration dates Cons Each domain stores all its cookies in a single string, which can make parsing data difficult Data is unencrypted, which becomes an issue because...... though small in size, cookies are sent with every HTTP request Limited size (4KB) SQL injection can be performed from a cookie Local storage Pros Support by most modern browsers Persistent data that is...... stored directly in the browser Same-origin rules apply to local storage data Is not sent with every HTTP request ~5MB storage per domain (that's 5120KB) Cons Not supported by anything before: IE 8 Firefox 3.5 Safari 4 Chrome 4 Opera 10.5 iOS 2.0 Android 2.0
__________________
Mobile, Web Apps Development Company | Extended Services in Digital Marketing KRIFY DOT CO |
![]() |
![]() |
![]() |
#3 |
Registered User
Join Date: Jan 2016
Posts: 227
|
Cookies and local storage serve different purposes. Cookies are primarily for reading server-side, local storage can only be read client-side. So the question is, in your app, who needs this data — the client or the server?
If it's your client (your JavaScript), then by all means switch. You're wasting bandwidth by sending all the data in each HTTP header. If it's your server, local storage isn't so useful because you'd have to forward the data along somehow (with Ajax or hidden form fields or something). This might be okay if the server only needs a small subset of the total data for each request. You'll want to leave your session cookie as a cookie either way though. As per the technical difference, and also my understanding: Apart from being an old way of saving data, Cookies give you a limit of 4096 bytes (4095, actually) - its per cookie. Local Storage is as big as 5MB per domain - SO Question also mentions it localStorage is an implementation of the Storage Interface. It stores data with no expiration date, and gets cleared only through JavaScript, or clearing the Browser Cache / Locally Stored Data - unlike cookie expiry.
__________________
zozoreview.com||Mints App Review||SalesEnvy Review EZ Popups Review||Nimbus Review ||Webinar Jeo Review||Webinar Jeo Bonus |
![]() |
![]() |
![]() |
#4 |
Registered User
Join Date: Jun 2016
Location: USA
Posts: 55
|
Local storage:
1. Local storage stores the data in the form of key and value 2. The data is stored for longer duration and remains in the browser unless the user deletes it explicitly, it remains even after a computer restart. 3. No way to specify the timeout period as the Cookies have. 4. Good to create an offline application that runs on the client machine (browser). 5. Easy to work with the JavaScript. 6. Local storage data is not sent to the server on every request (HTTP header) as it is purely at the client side. Cookies : 1. Good for small amount of data 2. Difficult to work with JavaScript 3. All data is transferred to and from server, so bandwidth is consumed on every request 4. Can specify timeout period so that cookies data are removed from browser
__________________
How to start multi vendor e commerce website |
![]() |
![]() |
![]() |
#5 |
Registered User
Join Date: Jul 2016
Posts: 28
|
Local storage
- Local storage stores the data in the form of key and value - The data is stored for longer duration and remains in the browser unless user delete it explicitly, it remains even after computer restart - No way to specify the time out period as the Cookies have - Good to store large amount of data, up to 4MB Cookies - Good for small amount of data - Difficult to work with JavaScript - All data is transferred to and from server, so bandwidth is consumed on every request |
![]() |
![]() |
![]() |
#6 |
Registered User
Join Date: Apr 2016
Location: pune
Posts: 583
|
Local storage is good to create an offline application that runs on the client machine.
Cookies are good for small amount of data and tough to work with JavaScript. |
![]() |
![]() |
![]() |
#7 |
Registered User
Join Date: Aug 2016
Posts: 20
|
Cookies are primarily for reading server-side, localStorage can only be read client-side.
Cookies allow you to store string only while using local storage you can store JavaScript but not object or array.
__________________
Mobile Phone Price in Pakistan |
![]() |
![]() |
![]() |
#8 |
Registered User
Join Date: Jul 2016
Location: hong kong
Posts: 49
|
local storage stores large amount of data and cookies stores small amount of data
|
![]() |
![]() |
![]() |
#9 |
Registered User
Join Date: Aug 2016
Posts: 640
|
Cookies data store temporarily and local stroage data store user can delete the information itself...
|
![]() |
![]() |
![]() |
#10 |
Registered User
Join Date: Apr 2016
Posts: 198
|
Local storage:
1. Local storage stores the data in the form of key and value 2. The data is stored for longer duration and remains in the browser unless the user deletes it explicitly, it remains even after a computer restart. 3. No way to specify the timeout period as the Cookies have. Cookies : 1. Good for small amount of data 2. Difficult to work with JavaScript 3. All data is transferred to and from server, so bandwidth is consumed on every request 4. Can specify timeout period so that cookies data are removed from browser
__________________
flats for sale in uttam nager east | property dealer in uttam nagar | flats for sale in uttam nagar west | flats for sale in Janak Puri | flats for sale in dwarka mor Last edited by kunalkumar; 10-13-2016 at 02:23 AM.. |
![]() |
![]() |
![]() |
#11 | |
Registered User
Join Date: Sep 2016
Posts: 85
|
Quote:
Hi, very important information thanks for sharing. |
|
![]() |
![]() |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|