Safari silently deleted our users' saved data after 7 days.
We built a web based project management tool, not a full SaaS with accounts at first, just a local first tool where everything saves to browser via IndexedDB. Think of it like Notion but everything stays in your browser, no server, no account needed. We marketed it as "your data never leaves your device" and people loved it, about 25K weekly active users mostly on desktop Chrome and Firefox where everything worked perfectly.
Then we started getting emails from users saying their entire project boards were gone. Not corrupted, not partially missing, completely wiped like they'd never existed. The weird thing was it was only iPhone and iPad users and pattern was always same, they'd use app heavily for a few days, then not open it for about a week, and when they came back everything was gone.
It took us way too long to figure this out because we kept looking for bugs in our code. We audited our IndexedDB write logic, checked for storage quota issues, added error boundaries around every database operation, added telemetry to track when data was being written and read. Our code was fine. The data was being saved correctly every single time. It was just disappearing on its own a week later.
Turns out Safari on iOS has a 7 day cap on "script writable storage" for websites that aren't added to home screen as a PWA. If user doesn't visit your site for 7 consecutive days, Safari automatically purges all their IndexedDB, localStorage, Cache API data, everything. This isn't a bug, it's a deliberate WebKit policy for "Intelligent Tracking Prevention" that Apple implemented to prevent cross site tracking. The problem is it also nukes legitimate application data for any web app that stores things locally, and Apple doesn't surface any warning to user or developer before it happens. Your data is just gone and there's no way to recover it.
The really painful part is that this doesn't affect Chrome on iOS because even though Chrome on iOS uses WebKit under hood, it manages its own storage policies differently. So our Chrome on iOS users were fine and our Safari users were getting their data wiped and we had no idea why the behavior was split because we assumed all iOS browsers behaved same since they all use WebKit.
We confirmed this exact behavior by testing on real iOS devices, opening app in Safari, writing data, then not touching it for 7 days and checking if data survived. some tool to automate this across different iOS versions because storage eviction rules have changed slightly between iOS 16 and iOS 18 and we needed to know exactly which versions were affected and which weren't. The 7 day wipe was consistent across all recent versions for Safari but behavior was slightly different for PWAs installed to the home screen where the data persisted longer.
The fix was a fundamental change. We added an optional account system with server side sync so users' data has a backup beyond browser's mercy. For users who still don't want to create an account we added a prominent warning specifically for Safari users explaining that their browser may delete saved data after 7 days of inactivity and recommending they either add the app to their home screen as a PWA or export their data regularly. We also built an auto export feature that saves a JSON backup to user's iCloud or local files every time they use app as a safety net.
If you're building any kind of local first web app that stores meaningful user data in IndexedDB or localStorage and you haven't tested what happens to that data on Safari after a week of inactivity, you need to test it immediately because your iOS Safari users might already be losing their data and you'll never see it in any error log because from Safari's perspective nothing went wrong.
[link] [comments]