I created a custom UI for the google translate javascript plugin by adding some buttons and then setting the googtrans cookie when the user selects a language. This works totally fine locally. However I noticed when I put it on a live site, the cookie gets set and then a duplicate cookie appears that overrides the one that I've set.
The mystery cookie seems to be the domain with a dot prepended to it. I've tried adding the dot to my cookie's domain, but that doesn't work and according to the docs, that dot will be ignored anyway.
I've tried just clearing the cookie manually through the Chrome console
document.cookie = "googtrans=; expires=" + new Date + "; domain=.domain.org; path=/";
and that does clear the cookie that I set, but leaves the duplicate cookie unchanged.
Anyone know a way of nuking all of the possible cookies or something? It's so strange that it only does this on a live site.
Nevermind, I randomly figured it out right after posting this. If I set two cookies, one WITH and domain and one WITHOUT, the one without a domain will write to the .domain.org cookie.
document.cookie = "googtrans=;" + new Date + ";path=/;domain=domain.org";
document.cookie = "googtrans=;" + new Date + ";path=/;";
I don't know why, because the documentation says that NOT specifying a domain means that subdomains are NOT included, which is what the dot prefix was originally for.