diff --git a/tarteaucitron.js b/tarteaucitron.js index f9c8827..4376bea 100644 --- a/tarteaucitron.js +++ b/tarteaucitron.js @@ -1227,10 +1227,11 @@ var tarteaucitron = { regex = new RegExp("!" + key + "=(wait|true|false)", "g"), cookie = tarteaucitron.cookie.read().replace(regex, ""), value = tarteaucitron.parameters.cookieName + '=' + cookie + '!' + key + '=' + status, - domain = (tarteaucitron.parameters.cookieDomain !== undefined && tarteaucitron.parameters.cookieDomain !== '') ? 'domain=' + tarteaucitron.parameters.cookieDomain + ';' : ''; + domain = (tarteaucitron.parameters.cookieDomain !== undefined && tarteaucitron.parameters.cookieDomain !== '') ? '; domain=' + tarteaucitron.parameters.cookieDomain : ''; + secure = location.protocol === 'https:' ? '; Secure' : ''; d.setTime(expireTime); - document.cookie = value + '; expires=' + d.toGMTString() + '; path=/;' + domain; + document.cookie = value + '; expires=' + d.toGMTString() + '; path=/' + domain + secure + '; samesite=lax'; }, "read": function () { "use strict";