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?