PageTemplate/Cookies
* set path and domain on consent cookie * if page uses https, tag cookies as secure * use samesite=lax so cookies get sent if user visits via external link
This commit is contained in:
parent
511e1a78e6
commit
e421bdba79
2 changed files with 9 additions and 5 deletions
|
|
@ -473,12 +473,16 @@ $WH.sp = function(z) {
|
|||
// Set cookie
|
||||
$WH.sc = function(z, y, x, w, v) {
|
||||
var a = new Date();
|
||||
var b = z + "=" + escape(x) + "; ";
|
||||
var b = z + "=" + encodeURI(x) + "; ";
|
||||
|
||||
a.setDate(a.getDate() + y);
|
||||
b += "expires=" + a.toUTCString() + "; ";
|
||||
|
||||
b += "SameSite=strict;";
|
||||
b += "samesite=lax; ";
|
||||
|
||||
if (location.protocol === 'https:') {
|
||||
b += "secure; ";
|
||||
}
|
||||
|
||||
if (w) {
|
||||
b += "path=" + w + "; ";
|
||||
|
|
@ -502,7 +506,7 @@ $WH.dc = function(z) {
|
|||
// Get all cookies (return value is cached)
|
||||
$WH.gc = function(z) {
|
||||
if ($WH.gc.I == null) { // Initialize cookie table
|
||||
var words = unescape(document.cookie).split("; ");
|
||||
var words = decodeURI(document.cookie).split("; ");
|
||||
|
||||
$WH.gc.C = {};
|
||||
for (var i = 0, len = words.length; i < len; ++i) {
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
$(document).ready(function() {
|
||||
$WH.qs('#consent-overlay #accept-btn').onclick = function () {
|
||||
$WH.sc('consent', 1000, 1);
|
||||
$WH.sc('consent', 1000, 1, '/', location.hostname);
|
||||
$WH.ge('consent-overlay').style.display = 'none';
|
||||
};
|
||||
$WH.qs('#consent-overlay #reject-all').onclick = function () {
|
||||
$WH.sc('consent', 1000, 0);
|
||||
$WH.sc('consent', 1000, 0, '/', location.hostname);
|
||||
$WH.ge('consent-overlay').style.display = 'none';
|
||||
};
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue