Skip to content

Commit 46afb53

Browse files
author
Jacek Gębal
committed
Update cookie settings to use a shared cookie across pages.
1 parent f00cd62 commit 46afb53

1 file changed

Lines changed: 10 additions & 13 deletions

File tree

docs/assets/topbar.js

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -301,19 +301,16 @@
301301
Each version stores consent in localStorage under its own base-path key
302302
(e.g. /utPLSQL/develop/.__consent). Copy a non-empty consent from any
303303
other version into the current version's key before Material checks it. */
304-
var baseEl = document.querySelector('base');
305-
if (baseEl) {
306-
var CONSENT_SUFFIX = '.__consent';
307-
var currentConsentKey = new URL(baseEl.href).pathname + CONSENT_SUFFIX;
308-
if (!localStorage.getItem(currentConsentKey)) {
309-
for (var i = 0; i < localStorage.length; i++) {
310-
var k = localStorage.key(i);
311-
if (k && k !== currentConsentKey && k.endsWith(CONSENT_SUFFIX)) {
312-
var val = localStorage.getItem(k);
313-
if (val && val !== '{}') {
314-
localStorage.setItem(currentConsentKey, val);
315-
break;
316-
}
304+
var CONSENT_SUFFIX = '.__consent';
305+
var currentConsentKey = location.pathname + CONSENT_SUFFIX;
306+
if (!localStorage.getItem(currentConsentKey)) {
307+
for (var i = 0; i < localStorage.length; i++) {
308+
var k = localStorage.key(i);
309+
if (k && k !== currentConsentKey && k.endsWith(CONSENT_SUFFIX)) {
310+
var val = localStorage.getItem(k);
311+
if (val && val !== '{}') {
312+
localStorage.setItem(currentConsentKey, val);
313+
break;
317314
}
318315
}
319316
}

0 commit comments

Comments
 (0)