Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wrap localStorage access in try-catch #34

Merged
merged 1 commit into from Jan 16, 2017

Conversation

trun
Copy link

@trun trun commented Jan 15, 2017

Many browsers may support localStorage, but disable access to it in certain situations. For example, Safari private browsing mode will raise an exception if you try to access localStorage from a third-party domain, resulting in unhandled errors like...

QuotaExceededError: DOM Exception 22: An attempt was made to add something to storage that exceeded the quota.

The easiest way to handle this for optional features is to simply try-catch all access to localStorage.

Many browsers may support localStorage, but disable access to it in certain situations. For example, Safari private browsing mode will raise an exception if you try to access localStorage from a third-party domain, resulting in unhandled errors like...

> QuotaExceededError: DOM Exception 22: An attempt was made to add something to storage that exceeded the quota.

The easiest way to handle this for optional features is to simply try-catch all access to localStorage.
@EtienneLem EtienneLem merged commit 637e456 into missive:master Jan 16, 2017
@EtienneLem
Copy link
Member

Thanks! 🤘

@trun trun deleted the fix/local-storage-disabled branch January 17, 2017 13:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants