Search code examples
phpcookiesdrupalxenforo

setcookie() from localhost for other local site with domain name


I have two site on my Linux installation : theming.dev xenforo.dev

On theming.dev, inside my code, I have :

setcookie("mycookiename", "cookievalue", time()+3600, "", "xenforo.dev");

But when I going on my local website called xenforo.dev, I don't have the cookie called "mycookiename", Why please ?

Note: setcookie() return true.

Thanks.


Solution

  • Browsers respect the same-origin policy, which prevents a website from setting cookies on other domain names.