是否可以更改window.URL.createObjectURL创建的对象的目标文档?

Is it possible to change the target document of the object created by window.URL.createObjectURL?

我了解到 window.URL.createObjectURL 创建的对象的生命周期与文档相关联。有什么方法可以更改目标文档吗?
我正在开发 chrome 扩展,我面临的问题是创建的 DOMString 对象失去了与我的 Blob 文件的联系,因为一旦用户刷新页面。我想在文档范围之外维护我的 Blob 文件 URL。也许我可以将它们移到我的后台脚本中?

Is there any way I can change the target document ?

您可以使用结构化克隆算法将 blob 对象本身传递给不同的文档或工作人员。安装 service worker 的生命周期可能比文档更长,这应该允许您将前向 blob 从一个文档传递到未来的文档。

无法传递 blob URI,因为 blob url 存储 gets cleaned on document unload

您也可以使用indexddb to store blobs