Jump to content

Block and unblock all cookies on safari?


Recommended Posts

Hello,

 

I'm having a hard time trying to create a workflow that could block "all cookies" on safari, and unblock them.

 

Do you think it is possible? I like to have all my cookies blocked, but sometimes I need to login to a website, and I have to go on safari -> preferences -> privacy -> and untick the "block all cookies" it's pretty annoying.

 

How would you do that? Do I have to use an AppleScript? I'm new to Alfred!

 

Thanks!

Link to post
16 hours ago, Bitcoin said:

Do I have to use an AppleScript?

 

Pretty much, yeah. You’d need to use UI scripting to open Safari’s preferences, select the appropriate tab and (un)tick the box. Keyboard Maestro is your best bet for that kind of thing. You might also be able to toggle the setting using the defaults command, but that would require quitting Safari before changing the options.

 

Can you not use a private window instead of toggling cookies on/off?

 

Alternatively, use a more configurable browser, like Firefox or something Chromium-based. You can use an adblocker like uBlock Origin to very easily block/unblock cookies. Or an application that allows you to create a single-site browser (SSB). When Safari 14 improves its WebExtension support, you might be able to install uBlock Origin in there, too.

 

If you can tell us what your goal is (i.e. why do you want to turn off cookies), we might be able to give you a more concrete solution.

Edited by deanishe
Link to post
6 hours ago, deanishe said:

Can you not use a private window instead of toggling cookies on/off?

 

Not as convenient unless we can make those the default. Seeing as we can’t even create new ones from AppleScript, I doubt that’s possible.

 

6 hours ago, deanishe said:

we might be able to give you a more concrete solution.

 

I’m thinking of two ways to go about it:

  1. You (@Bitcoin) should ask Apple (open the Feedback Assistant app and fill a report) to give us more granularity over what’s set in the browser. Chrome is a great example, as it has a clear interface to let you disable and enable cookies and JavaScript on a per-site basis.
  2. We could set the cookies directory (assuming there’s a single one) to not be writeable. Then have a Workflow that temporarily makes it so for when logging in is necessary.

 

6 hours ago, deanishe said:

When Safari 14 improves its WebExtension support, you might be able to install uBlock Origin in there, too.

 

First thing I thought when I saw the WWDC announcement. Not going to happen. Unless you mean you’re expecting Apple to implement those APIs somewhere in the future.

Link to post
2 hours ago, vitor said:

Not as convenient unless we can make those the default.

 

It's a lot easier to script than clicking on checkboxes in Safari's preferences.

 

2 hours ago, vitor said:

Unless you mean you’re expecting Apple to implement those APIs somewhere in the future.

 

Expecting, no. Hoping, yes.

Link to post
13 hours ago, deanishe said:

 

Pretty much, yeah. You’d need to use UI scripting to open Safari’s preferences, select the appropriate tab and (un)tick the box. Keyboard Maestro is your best bet for that kind of thing. You might also be able to toggle the setting using the defaults command, but that would require quitting Safari before changing the options.

 

Can you not use a private window instead of toggling cookies on/off?

 

Alternatively, use a more configurable browser, like Firefox or something Chromium-based. You can use an adblocker like uBlock Origin to very easily block/unblock cookies. Or an application that allows you to create a single-site browser (SSB). When Safari 14 improves its WebExtension support, you might be able to install uBlock Origin in there, too.

 

If you can tell us what your goal is (i.e. why do you want to turn off cookies), we might be able to give you a more concrete solution.

Thanks! 

 

I do have Keyboard Maestro, I will give it a try! To be honest I don't know anything about UI scripting atm, but I'm willing to learn, do you have any good resources?

 

I wanted to do that because I am always using "private windows" on safari, and EVERYTIME I open a new tab and search something on google they keep asking me "Google uses cookies blablablabla" -> I have to click on "I agree" and it is very annoying. I tried to block googleapi on little snitch, sometimes it works, sometimes it doesn't, but blocking googleapi.com makes a lot of things "buggy" on the internet! 

 

When I tick the "block all cookies" I don't have this problem anymore, google stops asking!

 

My goal is to stay on Safari and private windows! The new google.com cookie banner killed everything :(

 

>We could set the cookies directory (assuming there’s a single one) to not be writeable. Then have a Workflow that temporarily makes it so for when logging in is necessary.

 

This would be awesome! After some research I found Cookies.binarycookies in ~/Library/Cookies, I'm not sure it is the good one, but I will try to block it!

 

 

Thanks

 

Edited by Bitcoin
Link to post
8 hours ago, Bitcoin said:

This would be awesome! After some research I found Cookies.binarycookies in ~/Library/Cookies, I'm not sure it is the good one, but I will try to block it!

 

This won't stop websites from trying to set cookies, it will just stop them being saved beyond Safari restarts. And may crash the browser.

 

I'd recommend a site-specific browser that can refuse cookies. Unite, for example.

 

You create an application that only opens google.com (links to other sites open in your default browser), and set it to refuse all cookies.

Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...