Skip to content

Commit

Permalink
fix(replay): Better session storage check
Browse files Browse the repository at this point in the history
  • Loading branch information
mydea committed Jul 17, 2023
1 parent 2b4121f commit 6cc56c4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/replay/src/util/hasSessionStorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,10 @@ import { WINDOW } from '../constants';

/** If sessionStorage is available. */
export function hasSessionStorage(): boolean {
return 'sessionStorage' in WINDOW && !!WINDOW.sessionStorage;
try {
// This can throw, e.g. when being accessed in a sandboxed iframe
return 'sessionStorage' in WINDOW && !!WINDOW.sessionStorage;
} catch {
return false;
}
}

0 comments on commit 6cc56c4

Please sign in to comment.