Skip to content

Commit

Permalink
Fix exception handling when 3rd-party cookies are disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
cdauth authored and niketpathak committed Sep 13, 2023
1 parent e1305cc commit 2763131
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/ls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ let storage: Storage;
const init = () => {
if (isInit) return;
isInit = true;
storage = config.storage || localStorage;
try {
// sometimes localStorage/sessionStorage is blocked due to security policy. For example, within JS fiddle in incognito mode
storage = config.storage || localStorage;
storage.getItem('');
} catch {
storage = memoryStore();
Expand Down

0 comments on commit 2763131

Please sign in to comment.