Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

179
Views
Can't remove duplicate cookie

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.

Duplicate Cookie

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.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

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.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!