JavaScript cannot record to storage.

Asked 1 years ago, Updated 1 years ago, 267 views

Unable to log to storage.
I don't understand the grammar of the sample code and I don't think I know how to describe the key and value, but I don't know what's wrong with the browser's inspectors because they don't record anything in local storage.

manifest

"permissions": ["storage", "activeTab", "tabs",

contents script

var pref=["a", "b", "c"]; // value array
pref=browser.storage.local.set({key:"pref"});

javascript

2022-09-30 21:57

1 Answers

Modify the code as follows:

var pref=["a", "b", "c"];
browser.storage.local.set({"key":pref});


2022-09-30 21:57

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.