chrome.storage is undefined in chrome extension

Erik Rothoff picture Erik Rothoff · Sep 10, 2012 · Viewed 10.4k times · Source

I'm developing a Google Chrome extension, and have been working on one for a while. So it's been installed for a while, and I updated the manifest file to include the "storage" permission and reloaded the extension. However, when I try it in the console, chrome.storage is undefined. I restarted Chrome and still nothing.

My manifest file looks like this:

{
    ... snip ...
    "permissions": [
        "tabs",
        "http://*/*",
        "https://*/*",
        "chrome://favicon/",
        "storage"
    ]
}

I could reinstall the application, but I'm hesitant, since: Will it be the same for the existing users of the extension? It says in the documentation that the permission won't show any warnings or temporarily block the extension for adding more permissions.

My question is mainly, how will the existing users of my extension be affected? Will they get a warning and have the extension disabled until they actively enable it? Or is it just a local develpment issue?

Answer

marky-b picture marky-b · Oct 18, 2012

Your manifest looks fine. Did you reload your extension after making the change?

I pasted your manifest permissions into a new extension and called:

console.log(chrome.storage);

And recieved the following:

chrome.storage output

Note "local" and "sync", the two types of storage available to the extension.