小工具知识网

当前位置: 首页 > 行业知识 > chrome插件chrome.storage数据写入失败QUOTA

行业知识

chrome插件chrome.storage数据写入失败QUOTA

2026-11-08 06:52:43 来源:互联网转载
Unchecked runtime.lastError while running storage.set: QUOTA_BYTES_PER_ITEM quota exceeded at Object.callback

在开发���览器插件的时候,报错提示:超出存储限制,浏览器插件存储官方文档:https://developer.chrome.com/docs/extensions/reference/api/storage?hl=zh-cn

主要原因是存储区域有以下几种可用:

因为我使用的是sync同步存储,所以存储大小限制为100k,每项内容为8k,所以很容易就会超出限制,应该修改为local存储:

  chrome.storage.local.set({ key: value }).then(() => {    console.log("Value is set");  });  chrome.storage.local.get(["key"]).then((result) => {    console.log("Value is " + result.key);  });

我这里使用的是plasmo框架的存储依赖:Storage API – Plasmo

它默认使用的sync,所以要改为local就可以了:

import { Storage } from '@plasmohq/storage'export {}// 本地存储const storage = new Storage({    area: 'local',})

 

上一篇:乐园服务器崩溃怎么回事?

下一篇:轻松下载xoideos,详细步骤教程指南