I have no idea why I can’t set a value in chrome.storage.sync
(same issue with storage.local
), I’ve tried multiple solutions online, but sadly none of them work
This is my popup.js
file (linked to the popup.html
file)
window.addEventListener("DOMContentLoaded", () => {
let my_key = "some string";
chrome.storage.sync.set({my_key: value}, function() {
console.log('Value is set to ' + value);
});
chrome.storage.sync.get(['my_key'], function(result) {
console.log('Value currently is ' + result.key);
});
Everytime the output is Value currently is undefined
.