0
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 :

enter image description here

But why is it a blank object?

enter image description here

I have no permission issue, but why is it a blank object?

Aaron Musktin
  • 297
  • 3
  • 12

1 Answers1

0

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.

Xan
  • 74,770
  • 16
  • 179
  • 206
  • I got my stuff, but I do like this `var accounts = {}; chrome.storage.sync.get("accounts", function (obj) { accounts = obj; }); console.log(accounts); ` why the accounts is emtpy obj? I but when I console.log(accounts) within the storage scope it has something. – Aaron Musktin May 12 '15 at 15:56
  • 1
    @AaronMusktin That's because the function is asynchronous. See http://stackoverflow.com/q/23667086/2336725 – Teepeemm May 12 '15 at 16:08
  • Do not ask follow-up question in comments. – Xan May 12 '15 at 16:08