清除网站的存储持久性标志

Clear the storage persistent flag for a website

我在 Chrome 上使用 navigator.storage.persist() API,并设法将其设置为 true。但我想(至少为了测试)能够清除设置回到 false.

据我所知,API 定义不包括要清除的方法或标志。参见 https://developer.mozilla.org/en-US/docs/Web/API/StorageManager and the living standard: https://storage.spec.whatwg.org/#storagemanager

但是,就我的目的而言,如果有一种方法来自 'Site settings'、清除缓存选项,甚至像 chrome://appcache-internals 这样的自定义页面,这也是可以接受的/ 应用程序缓存页面。

如果不是,标志存储在哪里?即我需要在文件系统中删除什么来重置东西?

我无法找到清除特定 网站标志的方法。

但出于测试目的(如您所要求),由 StorageManager.persisted() 编辑的标志 return 可以通过以下方式清除:

  1. 导航到 chrome://settings/?search=cooki
  2. 点击Clear browsing data
  3. select Cookies and other site data 在弹出窗口中单击 Clear data 按钮

执行以上步骤后,StorageManager.persisted()开始returnfalse