Re-creating IndexedDB database after clearing browser cache.

25 views
Skip to first unread message

Urjasvi Suthar

unread,
Jun 20, 2023, 5:14:10 PM6/20/23
to emscripten-discuss
Hello,
I am fetching and storing file in IndexedDB as persistent storage. But when I check if file exists in IndexedDB (through fetch API) after clearing browser cache, then it silently fails. I noticed that IndexedDB database 'emscripten-filesystem' get deleted when I clear the caches.

My question is, do I have to re-create that database again myself (some js code) in order to work? or is there any other way that re-creates the database automatically?

What I do now is use databases() api to check if the database exists, if it doesn't than it reloads the page (reloading the page re-creates the database automatically). Is there any way that doesn't requires me or users to reload the page?

Thanks,
Urjasvi Suthar
Reply all
Reply to author
Forward
0 new messages