Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

How to auto-delete safari cookies on exit without surfing problems?

I'd like to auto-delete all cookies on quitting Safari. I already know it is possible to lock the cookie.plist file (/Users/USERNAME/Library/Cookies/cookie.plist) for that matter.

Unfortunately some websites loose their sessions when the cookie.plist file is locked, i.e. eBay. It’s possible to log-in but after some doings eBay asks for log-in again. The same problems came up on other log-in required websites too, although some are working.

What could I do to auto delete safari cookies on exit without surfing problems?

Mac Mini, Mac OS X (10.5.5)

Posted on Oct 3, 2008 1:48 AM

Reply
4 replies

Oct 4, 2008 12:53 AM in response to Barry Hemphill

Hi Barry

Thanks for your answer. The private browsing function of Safari is not exactly what I'm looking for due to the "several other things" that it does. There is no need for me to disable all these convenient functions, i.e. history list or auto fill.

What I would like to do is to block all cookies. Safari offers this, OK. But many websites need session cookies to display user specific data. Therefore to block all cookies is quite inconvenient (better said useless) for the everyday browsing.

IE gives the possibility to block all cookies except session cookies.
Firefox gives the option to delete all cookies when the user closes FF (which means that cookies are valid only for a session too).

Where do I have this function in Safari?

Many people help their self by locking the cookie.plist file (found on the Internet). Then Safari holds cookies in the memory till it is closed but doesn't keep them for further sessions. This helps but some log-in required websites are still not working, i.e. eBay.

I would like to know what I could do to block all cookies but session cookies in Safari OR to delete all cookies (and only cookies) on quit automatically?

Silvio

Oct 4, 2008 5:11 AM in response to sist

Hello silvio:

Now I see what you want to do!

As far as I know (I am certainly not an expert), Safari does not have features such as you describe. You could put that into the Apple process through OS X feedback (or a Safari bug report, although the lack of a feature is really not a bug.

Barry

P.S. I suspect there is an arcane UNIX command that will do what you want, but I completely avoid them as potentially dangerous. I did research a program full of GUI things that I use for troubleshooting (Cocktail), but it does not address the function you wish either.

Nov 14, 2008 8:58 AM in response to sist

Now I had some time to care about this topic and I solved it (Nobody said it will be easy.)

Safari does not provide any option to auto-delete cookies on quit like other browsers do. So the idea is do delete the cookies on shut down of Max OS X using a shell script:

*1. Create an empty Cookie file*

a) Open Safari
b) Go to Preferences –> Security - > Show Cookies
c) Delete all Cookies
d) Quit Safari without loading any website in between
e) Open Finder
f) Go to „/Users/XXXXXX/Library/Cookies/“ (Replace XXXXX with your username)
g) Copy „Cookies.plist“ to „CleanedCookies.plist“ in this folder

Done! Now you should see two files in the folder „~/Library/Cookies/“: „Cookies.plist“ and „CleanedCookies.plist“!


*2. Create autostart shell script*

a) Open Terminal
b) Type: „cd /Library/StartupItems/“
c) Type: „sudo mkdir /DeleteCookies“ - > Enter your password
d) Type: „sudo pico“ (a shell text editor will open)
e) Paste this inside:
{quote}
#!/bin/sh

. /etc/rc.common

#StartService ()
#{
#}

StopService ()
{
cp -f /Users/XXXXX/Library/Cookies/CleanedCookies.plist /Users/XXXXX/Library/Cookies/Cookies.plist
}

RestartService ()
{
StopService
}

RunService "$1"
{quote}
f) Change „XXXXX“ to your username (at two places!)
g) Press „Ctrl - X“ (it asks if it should save the document)
h) Press „Y“ (it asks for a file name)
i) Type „DeleteCookies“
j) Don’t close the Terminal! We will need it again.


*3. Create StartupParameters*

a) In Terminal type: „sudo pico“
b) Paste this inside (with { and }):
{quote}
{
Description = "DeleteCookies";
Provides = ("Deletes Safari cookies on shut down");
Uses = ("Disks");
}
{quote}
c) Press „Ctrl - X“ (it asks if it should save the document)
d) Press „Y“ (it asks for a file name)
e) Type „StartupParameters.plist“
f) Now you may close the Terminal

Now you should see two files in the folder „/Library/StartupItems/DeleteCookies/“: „DeleteCookies“ and „StartupParameters.plist“. Done!


*4. Restart the system*

a) Restart your computer
b) After reboot it will tell you that StartupItems do not have the right permissions
c) Click on „Correct Permissions“ (2 times for the two created files)
d) Restart your computer again.


Now your Safari-Cookies should be deleted automatically each time when you shut down your PC.

How to auto-delete safari cookies on exit without surfing problems?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.