Chrome.storage undefined in chrome extension

I have been developing the Google Chrome extension and have been working on it for a while. Therefore, it was installed for a while, and I updated the manifest file to enable the "storage" permission and restart the extension. However, when I try to use it in the console, chrome.storage is undefined . I restarted Chrome and did nothing.

My manifest file is as follows:

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

I could reinstall the application, but I hesitate, because: will it be the same for existing users of the extension? The documentation says that the permission will not show any warnings or temporarily block the extension to add additional permissions.

My question is mainly, how will existing users of my extension influence? Will they receive a warning and disable the extension until they activate it? Or is it just a problem of local development?

+6
source share
1 answer

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

I put your manifest permissions in the new extension and called:

 console.log(chrome.storage); 

And the following happened:

chrome.storage output

Note: "local" and "sync" are two types of storage available for expansion.

+7
source

Source: https://habr.com/ru/post/925052/


All Articles