Enable third-party cookies and site data for certain domains

I want example.com to be able to write and read third-party cookies and site data but no other domain may access any other domain's cookies and site data. It is only possible to globally enable/disable third-party cookies and site data.

Chrome's Cookies Settings

Ideally, I can even fine-tune access as in:

  • example.com may access cookies and data of web.example.com
  • example.com may access cookies of elpmaxe.com
  • all other third-party access is blocked

Is there an extension that supports this? How to configure it? Open source preferred.

An incomplete workaround is to have a Chrome profile in which you:

  • enable third party cookies and site data
  • only visit example.com and the websites, of which it should be able to access their data
  • accept that the other website will be able to read example.com's cookies and data

Solution 1:

You can do that easily with uMatrix.

This free and open-source browser extension is available:

  • for Google Chrome, and all Chromium-based browsers (Chromium, Vivaldi...)
  • for Firefox
  • for Opera

Example: Check the "Cookie" column on this following screenshot.

  • Green color = cookie authorized
  • Red color = cookie blocked

umatrix panel

Solution 2:

For me, the section "Sites that can always use cookies" worked:

enter image description here

I enabled the checkbox "All cookies, on this site only".