storage - 在 beforeunload 上删除 indexeddb 的方法

标签 storage indexeddb onbeforeunload

我正在将来自用户的数据保存在 indexeddb 中。当用户关闭我的应用程序(即浏览器)时,我想删除此存储。但是,由于 IndexedDB 请求是异步的,因此它们不会在 beforeunload 上执行。这就是为什么我很好奇,其他人是如何解决这个问题的?有什么办法吗?

圣诞快乐!

最佳答案

来自 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.

关于storage - 在 beforeunload 上删除 indexeddb 的方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34454425/

相关文章:

android - IndexedDB 在应用程序安装后自动恢复

javascript - 点击提交时不显示 onbeforeunload 警报

javascript - 如何在 beforeunload 事件上设置我自己的消息

c++ - 内存寻址与数组的混淆

更改 LTO 磁带的事件分区

android - 在不下载完整操作系统的情况下在eclipse中安装android sdk

html - 如何从 indexedDB 获取对象库?

java - openAssetFileDescriptor 不会截断 OneDrive 文件

caching - 如何将数据添加到 service worker 中的 IndexedDb,这些数据作为来自 api 的 http 响应

javascript - 从 window.onbeforeunload 中排除 DIV 内的点击