made cookie last 5 years

This commit is contained in:
Bea 2020-07-10 12:50:55 +02:00
parent 30fbc9b80a
commit a1104f6a24

View File

@ -6,9 +6,9 @@ function openPolicyPopup() {
function agreePolicyPopup() {
const _paq = window._paq || [];
_paq.push(['rememberConsentGiven']);
_paq.push(['rememberConsentGiven', 43800]);
$("#policy-popup").fadeOut(1000); // Disable the div
document.cookie = "consentGiven=true;SameSite=Lax"; // todo: check if already present? also, firefox was throwing a warning...
setCookie("consentGiven", "true", 1825) // todo: check if already present? also, firefox was throwing a warning...
}
function getCookie(cname) {
@ -26,3 +26,13 @@ function getCookie(cname) {
}
return "";
}
function setCookie(name, value, days) {
var expires = "";
if (days) {
var date = new Date();
date.setTime(date.getTime() + (days*24*60*60*1000));
expires = "; expires=" + date.toUTCString();
}
document.cookie = name + "=" + (value || "") + expires + "; path=/;SameSite=Lax";
}