I'm making a Firefox Add-On that needs to keep track of a list of words. From the main javascript file I can read and modify a stored Array under the name "list", but when I try to access it from the settings page I get an error:
ReferenceError: browser is not defined
Here is the function from which I try to access the local storage (this is in the .js file that is used in my .html settings page).
function EmptyList() {
if (confirm("Empty list?")){
browser.storage.local.set({
list : []
});
}
}
I don't understand what am I doing wrong. I'm not doing anything different from what they do in the mozilla tutorial .
Apparently it has something to do with the cache.
Disable and reenable the add-on (or remove it and add it again) and it works. Go figure.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.