You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Chrome 137中IndexedDB持久化存储无法启用且数据因磁盘空间不足被自动删除的问题求助

Chrome 137中IndexedDB持久化存储无法启用且数据因磁盘空间不足被自动删除的问题求助

我最近碰到个特别闹心的问题:本来想在本地HTML里用IndexedDB做本地存储,结果只要C盘剩余空间降到某个程度,数据库里的表就会被自动删掉。更头疼的是,不管我是用file:///协议打开本地文件、在localhost环境下测试,还是做成PWA来运行,都没办法把持久化存储给开起来——哪怕页面已经获得了通知权限(Notification.permission是granted状态)也没用,我用的是Chrome 137版本+Win10 64位系统。

我自己写了一段检测持久化存储状态的代码,想看看问题出在哪:

async function checkPersistentStorage() {
  if (!('storage' in navigator)) {
    console.log('NO Storage API support');
  }
  try {
    navigator.storage.persisted().then((isPersistent) => {
      console.log("Persistent storage: "+(isPersistent?"ON":"OFF"));
    });
    navigator.storage.persist().then((canPersist) => {
      console.log("Persistent storage can be enabled: "+(canPersist?"YES":"NO"));
    });
  } catch (error) {
    console.error('Storage API ERROR:', error);
  }
}
checkPersistentStorage();

运行后控制台输出是:

Persistent storage: OFF
Persistent storage can be enabled: NO

现在真的很困惑,要是没法解决这个问题,IndexedDB对我来说基本就没法用了,我总觉得应该有什么可行的 workaround 吧?有没有过来人能给我支支招?

内容来源于stack exchange

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.08 10:04:33