## The problem
Issue mixpanel/mixpanel-js#530 (closed, 10 comments): As the title says, when cookies are disabled in Safari, importing mixpanel causes the entire application to crash, reporting the following error: `Unhandled Promise Rejection: SecurityError: The operation is insecure.` After investigation, it was found that an operation on `localStorage` during the build of mixpanel caused this issue!!! ```js _.localStorage = _storageWrapper(win.localStorage, 'localStorage', localStorageSupported); ``` Please add try-catch or adjust the initialization timing for these statements, at least to prevent the entire application from crashing upon import.

## What fixed it
If importing mixpanel crashes your app with SecurityError (or 'Failed to read the localStorage property from Window') when cookies or storage are blocked, upgrade mixpanel-browser to v2.79.0 or later. The library now guards all storage access instead of touching localStorage at import time.