Trying to set and get values in my Chrome extension using local storage. Don't know what I did, but it's no longer working.¨
In manifest I have:
"permissions": [
"tabs", "http://*/*", "https://*/*", "storage"
],
This is the complete js, which sets a value and then tries to read it:
chrome.storage.local.set({'userid': "foo"}, function (result) {
chrome.storage.local.get('userid', function (result) {
alert(userid.result);
});
});
The alert says "undefined", not "foo" as expected.
The js is executed when i go to a certain page, specified in manifest for "content_scripts".
# View localStorage keys and valuesClick the Application tab to open the Application panel. Expand the Local Storage menu. Click a domain to view its key-value pairs. Click a row of the table to view the value in the viewer below the table.
Even if you're not actively using them, every open tab and enabled extension consumes disk space. It is easy to examine Chrome tabs and extensions that might be consuming too many resources in Chrome Task Manager.
When extensions are installed into Chrome they are extracted into the C:\Users\[login_name]\AppData\Local\Google\Chrome\User Data\Default\Extensions folder. Each extension will be stored in its own folder named after the ID of the extension.
User data can be automatically synced with Chrome sync (using storage. sync ). Your extension's content scripts can directly access user data without the need for a background page.
Doh, I figured it out. It should be:
alert(result.userid);
(reverse userid and result)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With