Add support for CacheStorage on iOS
See original GitHub issueFor my app (https://calories.fitness) I’m using your library and everything works great!
However I discovered that on iOS the local storage isn’t shared between the app you add to your home screen (PWA) and the website. According to https://jakub-kozak.medium.com/how-to-share-state-data-between-a-pwa-in-ios-safari-and-standalone-mode-64174a48b043 this can be worked around by using CacheStorage instead if iOS Safari is detected.
Would you accept a pull request that makes CacheStorage
the preferred storage method on iOS Safari (perhaps store in both, prefer CacheStorage if found and fall back to local storage)?
Here is a working implementation of getItem
and setItem
with CacheStorage
: https://codesandbox.io/s/cachestorage-example-forked-jvec5f
Issue Analytics
- State:
- Created a year ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
iOS 12 Safari CacheStorage API get… - Apple Developer
I'm facing an issue regarding usage of the ServiceWorker and CacheStorage API. This issue only occurs on the new iOS 12.x releases. With...
Read more >CacheStorage - Web APIs | MDN
This consists of calling CacheStorage.open to create a new cache, then using Cache.addAll to add a series of assets to it.
Read more >Is cache storage shared on iOS 15 between a standalone ...
According to what I read, beginning with iOS 13 cache storage is shared. This means that a standalone PWA can accesss the same...
Read more >CacheStorage
Chrome Edge Internet Explorer Opera
delete. Experimental Chrome Full support 40 Edge Full support 16 IE No support No Oper...
has. Experimental Chrome Full support...
Read more >How to share cacheStorage between Safari and PWA ...
I am trying to share data between Safari and a PWA/Standalone mode "Add to Homescreen" app in iPadOS 14 (not iOS) using cacheStorage....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yeah that would work, but at that point it will be easier to just implement my own version of
svelte-local-storage-store
since I need to do this wrapping for a few stores and it’s only 50 loc. I’ll give it a try and report back!OK let me know,
You can wrap the code I shared above in a function, and you would have a reusable store.
I will close for now, but feel free to re-open if you find blockers