Skip to content

Commit 6cc56c4

Browse files
committed
fix(replay): Better session storage check
1 parent 2b4121f commit 6cc56c4

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/replay/src/util/hasSessionStorage.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,10 @@ import { WINDOW } from '../constants';
22

33
/** If sessionStorage is available. */
44
export function hasSessionStorage(): boolean {
5-
return 'sessionStorage' in WINDOW && !!WINDOW.sessionStorage;
5+
try {
6+
// This can throw, e.g. when being accessed in a sandboxed iframe
7+
return 'sessionStorage' in WINDOW && !!WINDOW.sessionStorage;
8+
} catch {
9+
return false;
10+
}
611
}

0 commit comments

Comments
 (0)