Problem description:
I have 3 different domains installed on one multisite Wordpress instance and I want to manage one cookie acceptance that will confirm all 3 domains cookies acceptance. I mean when someone visiting website first time will accept Cookies on domain one.com and then he would not need to do it on the second.com domain. etc. I mean i would like to propagate accepting Privacy Policy on all domains on one Wordpress domain.
Solution I tried:
I wrote my own plugin that add iframes of two different domains on every domain in case of sending them cookies that user accepted:
contentWindow.postMessage(cookieParsed, domain);
and then read it to create cookies on different domains:
window.addEventListener('message', (event) => {
document.cookie = 'notice_acceptance_cookie_name=' + event.data + ';path=/'+';expires='+ expiredPeriod = ';SameSite=None; Partitioned; Secure;
});
I also added in .htaccess in main Wordpress directory:
<IfModule mod_headers.c>
#Header set Cache-Control "private"
Header set Access-Control-Allow-Origin: *
Header set Access-Control-Allow-Credentials true
Server
Nginx
Problem
The problem is that it works properly in Chrome Browser and does not work in Mozilla Firefox and Safari. I read that Firefox does not allow to add cookies on different domain (CORS rules) but there should be way to process it. Can you advice anything? I will be helpful for any suggestions. Maybe there is different, easier solutlion for this problem. Thank you in advance.