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

Safari Handling of localStorage in Private Mode #17827

Closed
ericmutta opened this issue Jun 30, 2022 · 1 comment · Fixed by #18416
Closed

Safari Handling of localStorage in Private Mode #17827

ericmutta opened this issue Jun 30, 2022 · 1 comment · Fixed by #18416
Labels
Content:WebAPI Web API docs effort: small This task is a small effort. good first issue A good issue for newcomers to get started with. help wanted If you know something about this topic, we would love your help!

Comments

@ericmutta
Copy link
Contributor

MDN URL

https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API

What specific section or headline is this issue about?

https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API#private_browsing_incognito_modes

What information was incorrect, unhelpful, or incomplete?

The following sentence is outdated:

Then there are some browsers, most notably Safari, that have opted for a solution where storage is available, but is empty and has a quota of 0 bytes assigned, effectively making it impossible to write data to it.

What did you expect to see?

I have just tested use of localStorage with Safari on iOS 11.0 and iOS 15.4 and both of them very much support reading and writing data to localStorage when using private tabs. The only difference with Chrome and Firefox is that localStorage is NOT shared between private tabs.

Historically it appears you couldn't write to localStorage but as of June/2022 this doesn't seem to be the case, even for old versions of Safari (such as the one on iOS 11.0 released 5 years ago) so I suggest that the docs should be updated to avoid giving the wrong impression (perhaps we should use the words "...most notably, old versions of Safari ..." to emphasize that users should test their code to confirm the issue rather simply assuming it still applies).

Do you have any supporting links, references, or citations?

You can spin up Safari on iOS 11 (using services like BrowserStack.com), open the DevTools, go to the console and type window.localStorage.setItem('foo', 'bar') and it won't fail (you can get the value back by window.localStorage.getItem('foo') and you'll see the expected value).

Do you have anything more you want to share?

No response

MDN metadata

Page report details
@github-actions github-actions bot added Content:WebAPI Web API docs needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. labels Jun 30, 2022
@sideshowbarker sideshowbarker added good first issue A good issue for newcomers to get started with. help wanted If you know something about this topic, we would love your help! effort: small This task is a small effort. and removed needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. labels Jul 1, 2022
@ericmutta
Copy link
Contributor Author

Thanks @joel-hamilton for the fix and @sideshowbarker for merging it 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:WebAPI Web API docs effort: small This task is a small effort. good first issue A good issue for newcomers to get started with. help wanted If you know something about this topic, we would love your help!
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants