Skip to content

Commit 17d24bf

Browse files
authored
Merge pull request #3872 from GochoMugo/fix/denied-storage-access
fix: handle denied storage access
2 parents 767fda2 + 8cc571f commit 17d24bf

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/tracker/index.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,13 @@
1212
if (!currentScript) return;
1313

1414
const { hostname, href, origin } = location;
15-
const localStorage = href.startsWith('data:') ? undefined : window.localStorage;
15+
16+
let localStorage;
17+
try {
18+
localStorage = href.startsWith('data:') ? undefined : window.localStorage;
19+
} catch {
20+
/* (DOMException) SecurityError: Access is denied for this document. */
21+
}
1622

1723
const _data = 'data-';
1824
const _false = 'false';

0 commit comments

Comments
 (0)