From c75cb0b8e384454228712f9a30a21e2f8967fa33 Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Mon, 20 Dec 2021 16:10:39 +0100 Subject: [PATCH] Cookie consent: Fail softly if localStorage is unavailable --- src/pretix/static/pretixpresale/js/ui/cookieconsent.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/pretix/static/pretixpresale/js/ui/cookieconsent.js b/src/pretix/static/pretixpresale/js/ui/cookieconsent.js index 0ff66588e8..2e07c30740 100644 --- a/src/pretix/static/pretixpresale/js/ui/cookieconsent.js +++ b/src/pretix/static/pretixpresale/js/ui/cookieconsent.js @@ -20,6 +20,13 @@ $(function () { return; } + if (!window.localStorage) { + // Consent not supported. Even IE8 supports it, so we're on a weird embedded device. + // Let's just say we don't consent then. + update_consent({}) + return; + } + var storage_val = window.localStorage[storage_key]; var show_dialog = !storage_val; var consent_checkboxes = $("#cookie-consent-details input[type=checkbox][name]");