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

120
Views
Getting a 'SameSite' cookie warning when I set my own cookies

I'm using the following code to set a cookie

function setCookie(key, value, path, time) {
if (time != '') {
    var expires = new Date();
    expires.setTime(expires.getTime() + time);
    document.cookie = key + '=' + value + ';path=' + path + ';expires=' + expires.toUTCString();
}

This code works just fine, but I'm getting a warning in the console that says...

Cookie “cookie_name” will be soon rejected because it has the “SameSite” attribute set to “None” or an invalid value, without the “secure” attribute. To know more about the “SameSite“ attribute, read https://developer.mozilla.org/docs/Web/HTTP/Headers/Set-Cookie/SameSite

I tried adding 'samesite=lax' to the last line in the code above after the expires value, but that didn't seem to have any effect. What do I need to do in order to eliminate this warning?

about 4 years ago · Juan Pablo Isaza
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!