Safari Handling of localStorage in Private Mode #17827
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!
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:
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 tolocalStorage
when using private tabs. The only difference with Chrome and Firefox is thatlocalStorage
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 bywindow.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
en-us/web/api/web_storage_api
The text was updated successfully, but these errors were encountered: