Chrome扩展程序:使用chrome.storage.sync.get获取空白对象? [英] Chrome extension : got blank object using chrome.storage.sync.get?
问题描述
chrome.storage.sync.get(accounts,function(obj){
console.log(obj);
});
不知道有什么问题我有帐户作为键和一些值,但是我使用上面的代码得到空白对象。
正如你所看到的,我确实在localstorage中有一些东西:
$ b
但为什么它是空白对象?
我没有权限问题,但它为什么是空白对象?
chrome.storage
。 开发工具只显示 localStorage
;有开发工具的第三方扩展,例如显示 chrome.storage
。 存储区域资源管理器
localStorage
, chrome.storage.local
和 chrome.storage.sync
全都不同。
chrome.storage.sync.get("accounts", function (obj) {
console.log(obj);
});
not sure what's wrong i have accounts as key and some value, but I got blank object using above code.
As you can see I did have something in my localstorage :
But why is it a blank object?
I have no permission issue, but why is it a blank object?
You're confusing localStorage
storage and chrome.storage
.
Dev Tools only show localStorage
; there are third-party extensions to Dev Tools that show the chrome.storage
, e.g. Storage Area Explorer
localStorage
, chrome.storage.local
and chrome.storage.sync
are all different.
这篇关于Chrome扩展程序:使用chrome.storage.sync.get获取空白对象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!