?
Solved

Protecting a cookie against user deletion

Posted on 2006-04-03
5
Medium Priority
?
269 Views
Last Modified: 2013-11-18
Hi
I want to store a cookie that the user will want to keep intact - it contains some preferences for site layout .

I know that Firefox has a plugin (called CookieCuller) which is presumably in js which alllows the user to protect cookies against accidental deletion.

Can someone give me some guidance as to how to do this?

thanks
0
Comment
Question by:Mutley2003
  • 3
  • 2
5 Comments
 
LVL 35

Expert Comment

by:TimYates
ID: 16358533
If you download the xsi file from here:  http://cookieculler.mozdev.org/installation.html

To your hard disk, then you can open it with winzip (or similar), and look at the code inside cookieculler.jar (again open it with winzip)

Basically, cookieculler just saves a list of "protected cookies" into its preferences, so that you cannot delete those cookies with "cookieculler"

I assume that you can still delete cookies with the webdevelopers toolbar, etc?

You can't just do this from javascript run on the webpage...

Tim
0
 

Author Comment

by:Mutley2003
ID: 16359293
Thanks Tim

There is a LOT  of code in that xsi file, and I don't pretend to understand it, but it is still just js, right?

So, OK, CookieCuller only protects cookies from CookieCuller, but since js has no access to the filesystem how does it "save a list of protected cookies" ?  In a cookie?

Or is it setting some special fields in those cookies (like ProtectedByCookieCuller=TRUE).. I guess that is a possibility, although surely screwing around with third party cookies is not safe.

So, if we have a cookie containing a list of cookies, how do we know the browser will not delete that master cookie when it reaches its cookie limit? Or is my understanding of that flawed ?? I have this idea that browsers are free to kill cookies once the RFC prescribed limits are breached.

hmm

0
 
LVL 35

Accepted Solution

by:
TimYates earned 2000 total points
ID: 16359350
No, it may be javascript code, but it is executed by the Firefox browser as if it is part of the browser..

Basically Firefox allows plugins to be written in javascript

And the firefox plugins can access preferences file for themselves by calling the Firefox API

This can't be done from inside a webpage, as the javascript in a webpage will be running inside the security sandbox

Tim
0
 

Author Comment

by:Mutley2003
ID: 16366059
ok, thanks Tim .. I understand now.

I guess the only way I have of protecting the cookies is to write a small app (not js) that will allow the user to keep a copy of the cookie somewhere else in case it gets deleted, and then restore it. Or keep the preferences on the server

thanks again
0
 
LVL 35

Expert Comment

by:TimYates
ID: 16368063
Good luck!  Sorry there wasn't an easier solution :-(

And Thanks!

Tim
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
The purpose of this video is to demonstrate how to set up the WordPress backend so that each page automatically generates a Mailchimp signup form in the sidebar. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question