1
0
Fork 0
mirror of https://github.com/infinum/cookies_eu synced 2023-03-27 23:21:16 -04:00

Merge pull request #72 from davidhrbac/secure_cookie

Set cookie to secure when SSL connection
This commit is contained in:
Gabrijel Škoro 2019-01-30 14:46:40 +01:00 committed by GitHub
commit c26aa6b42d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -24,7 +24,8 @@ var cookiesEu = {
},
setCookie: function() {
Cookies.set('cookie_eu_consented', true, { path: '/', expires: 365 });
var isSecure = location.protocol === 'https:';
Cookies.set('cookie_eu_consented', true, { path: '/', expires: 365, secure: isSecure });
var container = document.querySelector('.js-cookies-eu');
container.parentNode.removeChild(container);