Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ways to delete indexeddb on beforeunload

I am saving data from the user in an indexeddb. When the user closes my app (i.e. the browser), I want to delete this storage. However, since IndexedDB requests are asynchronous, they won't be executed on beforeunload. This is why I am curious to see, how other people solved this issue? Is there any way at all?

Merry Christmas!

like image 217
stiller_leser Avatar asked Oct 29 '25 00:10

stiller_leser


1 Answers

An answer that taken from MDN:

The synchronous API being intended for use only with Web Workers. The synchronous version was removed from the spec because its need was questionable, however it may be reintroduced in the future if there is enough demand from web developers.

like image 176
Daniel Jo Avatar answered Oct 31 '25 18:10

Daniel Jo