Skip to content

armgit / umami

Public Imported from GitHub
0

Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.

fix: handle denied storage access

GochoMugo8cc571f548d2
diff --git a/src/tracker/index.js b/src/tracker/index.js
index ad3648aca..85d274301 100644
--- a/src/tracker/index.js
+++ b/src/tracker/index.js
@@ -12,7 +12,13 @@
if (!currentScript) return;
const { hostname, href, origin } = location;
- const localStorage = href.startsWith('data:') ? undefined : window.localStorage;
+
+ let localStorage;
+ try {
+ localStorage = href.startsWith('data:') ? undefined : window.localStorage;
+ } catch {
+ /* (DOMException) SecurityError: Access is denied for this document. */
+ }
const _data = 'data-';
const _false = 'false';