I am working on an extension that allows me to copy data from a website on one tab to another open on a different tab. The two websites have different origins. I tried browser.storage.local
but it doesn't seem to be working:
Storing data:
browser.storage.local.set({
'title': 'some title',
'date': 'some date'
});
Retreiving data:
let promise = browser.storage.local.get(['title', 'date']);
promise.then(function(item) {
console.log ('promise success');
console.log('title: ', item.title);
}, function(error) {
console.log('error', error);
});
Why is it not working and how do I fix it. Thanks in advance.
I just figured it out, it requires a storage permission. I added the following line to my Manifest.json file and it worked:
"permissions": ["storage"],
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.