我一直在使用chrome.storage.sync
API作为我正在构建的Google Chrome扩展程序的一部分。
该API清楚地表明,如果您使用自己的Google帐户登录到Chrome浏览器并使用chrome.storage.sync.set
,则下次您使用相同的Google帐户登录并使用时,将可以访问所有设置的数据chrome.storage.sync.get
。
API未特别明确的是未登录Chrome浏览器时的chrome.storage.sync
行为。
从我的实验似乎是,当没有到Chrome浏览器中签,chrome.storage.sync.set
并chrome.storage.local.set
保存到不同的地方。
它在API中说:
Chrome处于离线状态时,Chrome会将数据存储在本地。下次浏览器在线时,Chrome会同步数据。即使用户禁用了同步,storage.sync仍将起作用。在这种情况下,其行为将与storage.local相同。
看来那个地方
Chrome浏览器将[已同步]数据存储在本地
与chrome.storage.local.set
存储位置不同。谁能确认这是真的吗?
当Chrome.storage.sync无法连接到Internet时,它将数据存储在本地的新临时位置中。它不会将其存储在Chrome.storage.local中,仍然可以通过Chrome.storage.sync访问。
混乱似乎是在语言上。Chrome.storage.local是一个单独的位置,Chrome.storage.sync的行为类似于Chrome.storage.local。它没有使用相同的存储位置
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句