question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add support for CacheStorage on iOS

See original GitHub issue

For 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:closed
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
mrexodiacommented, Aug 15, 2022

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!

0reactions
joshnusscommented, Aug 15, 2022

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found