6 ms·
Last I looked into it, it's not permanent in any browser. If you're low on disk space, stuff will get deleted. https://twitter.com/tomayac/status/16136053184070
by streptomycin 3y ago
Last I looked into it, it's not permanent in any browser. If you're low on disk space, stuff will get deleted. https://twitter.com/tomayac/status/1613605318407094275 https://twitter.com/tomayac/status/1613605318407094275
It kind of makes sense, given the constraints the browser devs have given themselves. Since there's no way for users to see/manage these OPFS files directly, there is no good alternative except automatically deleting stuff if disk space is low.
What would really be nice would be if we could just create normal files and let users control them, but that doesn't seem to be in the cards. And it sucks. The #1 question I get for my PWA is "how do I stop it from sometimes deleting all my data?" and there's really no good answer.
- thayne 3y agoThere is a big difference between deleting when disk storage is low, and deleting if you haven't opened the app in 14 days.
- acdha 3y agoYes, but that is also the difference between it being used as a replacement for tracking cookies. There’s a reason why every browser not made by an ad network is more concerned about privacy.
- thayne 3y agoHow would it be used as a replacement for tracking cookies? The data is only accessible from a single origin (hence the name Origin private file system). This feature can actually benefit privacy, because it allows creating web apps that don't have to send data back to a server to store it.
- acdha 3y agoIt’s a potential long-term persistent identifier. Safari already deletes first-party cookies from sites you don’t regularly access so they need to review any other storage mechanism to ensure it doesn’t turn into a replacement with different policies. That’s also why they have a different policy for a PWA, where the user has expressed a stronger intention to use that site regularly. In this case, they implemented it following the same storage standard for everything to avoid inconsistencies. https://storage.spec.whatwg.org/ https://storage.spec.whatwg.org/ > This feature can actually benefit privacy, because it allows creating web apps that don't have to send data back to a server to store it. It’s more convenient in some cases than the other APIs for doing that, but it’s held to the same privacy policies. If you want persistent storage, you have to ask the user for it.
- streptomycin 3y agoYes, but they are both symptoms of the same problem. Ultimately as a PWA developer I'd love to just be able to save a file to disk and be able to rely on it the same as a native app can. And currently there are also other situations where browsers will delete your data, in addition to low disk space and the weird iOS usage requirements.
- lioeters 3y ago> no good alternative except automatically deleting stuff if disk space is low The good alternative is to use navigator.storage.persist(), which requests the user for permission to use persistent storage. Unlike other browsers, WebKit/Safari ignores this. Instead of asking the user for permission, it automatically grants or refuses permission based on website heuristics.
- streptomycin 3y agoThat is definitely not a good alternative. Three major problems I've had with it: 1. That heuristic is not just in Safari, it's in Chrome too. Firefox is the only one with a normal permission dialog. And the heuristic is really confusing for users! They come to me and say "how can I stop my data from being deleted?" and I have no answer if the heuristic says they can't enable persistent storage. 2. It only helps with eviction (deleting data due to low disk space), not other scenarios where data may be deleted. Such as clearing the "browser cache" without realizing what that implies, which may even be done automatically or through some third party app. 3. I have a place in my app settings page where users can see their persistent storage setting and also enable it if they want. I have many reports of users who enable it, then check back some time later, and somehow it's disabled. So the persistent data setting seems to not be persistent.
- lioeters 3y agoI've been working on a local-first web app, and ran into some of the same issues. Good to learn about these other pain points.. All of these make the so-called "persistent" local storage unreliable and impractical. I don't understand how browser vendors expect people to use such a feature where the data can be deleted at any time, where neither the developer nor the user has any control over how that happens.
- streptomycin 3y agoI don't think there is a real plan, I think it's just the current state of the power struggle between two competing factions. Some browser devs prioritize web apps being as good as native apps. And some browser devs prioritize not causing problems for users (such as using too many resources). Seems like sometimes one faction sneaks something past the other to advance their cause a bit, and in total the result is incoherent.