0

How can I save one or more specific cookies in Chrome but automatically delete all others (including those from the same domain) upon browser close or open?

My original thought was to find a cookie extension which either:

  • Whitelisted a specific cookie and gave me the ability to delete all others at start up or shutdown

    or

  • Allows me to auto-import a cookie on start up, and use the Chrome cookie settings to remove them all at shutdown.

However the problem seems is that I can't find an extension that does what I want. There are extensions like Vanilla Cookie Manager which allow me to whitelist cookies for a specific domain and delete all others but this fails to accomplish what I need.

Are the extensions or other options which allow me to accomplish either of the above?

marked as duplicate by Ƭᴇcʜιᴇ007, Sathyajith Bhat Nov 9 '14 at 13:53

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

0

I came up with a hack of a solution which works and is transparent to the user but has it's own security flaws. Therefore I will leave this open in case there is a more legitimate mechanism to solve this with Chrome or Chrome Extensions in Windows 7.

  1. Set Chrome to discard all cookies on exit
  2. Make the directory C:\ChromeHelper - Do not put this in either of your program files directories or you will always get a UAC prompt when you run Chrome.
  3. In Chrome, delete all the cookies except for the one(s) that you want to keep.
  4. Copy the cookie file (%LocalAppData%\Google\Chrome\User Data\Default\Cookies) to the ChromeHelper directory
  5. Download the GPL program Create Hidden Process (CHP) which allows you to run any command or Windows program in a hidden window. Extract the contents of the zip file to the ChromeHelper directory
  6. Rename chp.exe to something more descriptive and known only to you. For example rename chp.exe RunCustomChromeSession.exe
  7. Create a batch file startchrome.bat in the ChromeHelper directory. See below for the contents of the file.
  8. Create / Change Shortcuts to execute your program. (Target: "C:\ChromeHelper\RunCustomChromeSession.exe" startchrome.bat) (Start in: "C:\ChromeHelper") Choose the icon from Chrome.
  9. Run, and then uncheck the checkbox "Always ask before opening this file" on the Open File Security Warning dialog box.
  10. If necessary whitelist the RunCustomChromeSession.exe program with your anitvirus software.

Obviously this is not the best solution as you now have a program which can run arbitrary software completely hidden from view installed on your machine. Nevertheless in low-security situations this is a working solution.

startchrome.bat:

copy /y "C:\ChromeHelper\Cookies" "%LocalAppData%\Google\Chrome\User Data\Default\Cookies"
Start /MAX "chrome" "%ProgramFiles(x86)%\Google\Chrome\Application\Chrome.exe"

Not the answer you're looking for? Browse other questions tagged or ask your own question.