Workaround: Google Chrome – domain-blacklist for cookies

Sponsored Link
But for some reasons the cookie-management has only 3 modes, without the ability to define whitelists or blacklist with specific domains, probably the google-boys knows who would be blacklist-chartleader. However, for me this is a knock-out criterion and as I couldn’t find a better solution, here is a quick and dirty workaround for a domain-blacklist, at least it prevents persistent cookies for special domains while cookies are generally accepted.

The chrome-cookies are stored in a sqlite database file, the following script deletes all cookies from defined domains before starting chrome (sqlite3 package is required), furthermore the “local state” file will be deleted (contains some client information) and the UserAgent ID can be faked (eg Safari/WinXP, commented out) .

Maybe this script it’s useful to someone, just customize it to your needs and save it to /usr/bin

#[email protected]


#delete cookies containing one of that strings in domain-name before starting chrome

for (( i=0;i<${#COOKIES_BLACKLIST[@]};i++)); do
echo "delete from cookies where host_key like '%${COOKIES_BLACKLIST[${i}]}%';"
sqlite3 $COOKIES_FILE "delete from cookies where host_key like '%${COOKIES_BLACKLIST[${i}]}%';"

#set AGENT_ID to fake the user-agent identification
#AGENT_ID="Mozilla/5.0 (Windows; U; Windows NT 5.1; en) AppleWebKit/522.11.3 (KHTML, like Gecko) Version/3.0 Safari/522.11.3"


if [ -n "$AGENT_ID" ]; then
exec `google-chrome --user-agent="$AGENT_ID"`
exec google-chrome
exit 0

Sponsored Link

Leave a comment

Your email address will not be published. Required fields are marked *