#javascript #cookies
Вопрос:
Я не могу получить все свои файлы cookie с помощью безопасного флага.
Вот все сообщения об ошибках на консоли:
Cookie “__tld__” 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 commons.7eb7c3f69feee6a0ec06.8.js:502:931
Cookie “__tld__” 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 commons.7eb7c3f69feee6a0ec06.8.js:502:931
Cookie “ajs:test” 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 commons.7eb7c3f69feee6a0ec06.8.js:502:931
Cookie “ajs:test” 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 commons.7eb7c3f69feee6a0ec06.8.js:502:931
Cookie “ajs:cookies” 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
Я сделал этот код ниже для файлов cookie:
function createCookie(name, value, days) {
if (days) {
var date = new Date();
date.setTime(date.getTime() (days * 24 * 60 * 60 * 1000));
var expires = "; expires=" date.toGMTString();
} else
var expires = "";
document.cookie = name "=" value expires "; path=/;HttpOnly;SameSite=None;Secure";
}
function readCookie(name) {
var nameEQ = name "=";
var ca = document.cookie.split(';');
for ( var i = 0; i < ca.length; i ) {
var c = ca[i];
while (c.charAt(0) == ' ')
c = c.substring(1, c.length);
if (c.indexOf(nameEQ) == 0)
return c.substring(nameEQ.length, c.length);
}
return null;
}
function eraseCookie(name) {
createCookie(name, "", -1);
}
Я понятия не имею, какие файлы cookie вызывают эту проблему, потому что я не использую никаких других функций JavaScript для создания каких-либо файлов cookie.