Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

cookies are persistence?  RSS feed

 
kri shan
Ranch Hand
Posts: 1489
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Whether cookies are persistence? because cookies are stored in the local disk.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
They are persistent on that machine if the expire attribute is set. They are not persistent if you need that information and the user logs on another machine.

Is that what you are after?
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The quick answer is "Yes, sort of".

Firstly there are two types, persistent and session cookies. The persistent type get written to the filesystem, the session ones get destroyed when you close the browser.

It is poor form to use them as a type of persistence though. Firstly they can be blocked by many browsers or deleted by users, so you can't rely on them. They are also accessible by the user, so the user can read the data and potentially change it.

Consider a simple case where someone logs into your system and to prevent them having to log in again, you write their user ID to their local file system as a cookie. By changing the cookie value, the user now has the ability to log in as anyone they like.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!