Firstly, yes i googled the problem (for 4 hours yesterday), and the answers didnt help in my case ;)
Im creating a browser extension and i want to have a little popup to manage the Settings of the Addon. The popup.html has a script tag on popup.js, in which i write the values to the local storage: (in this i write the value of a checkbox)
chrome.storage.local.set({enabled: checked}, function() {
console.log('Value is set to ' + checked);
});
Problem 1: If i write it to storage like that it says its written, but i cant find the value in the debugger. I can find a value if i set it using "localStorage.setItem"
Going on, in my content script i obviously want to read out the value, and here i cant read it with chrome.storage.local.get NOR with localStorage.getItem.
If i do a console.log in my content script, it outputs to the console of the website im visiting and not in the addon popups console. Shouldnt the content script be in the addon scope too?
How can i simply exchange values between my content script and my settings popup?
Here is my manifest.json:
{
"name": "test",
"version": "0.1",
"manifest_version": 2,
"content_scripts": [
{
"matches": ["<all_urls>"],
"run_at": "document_start",
"js": ["randomize.js"]
}
],
"browser_action": {
"default_popup": "popup.html",
"default_title": "Settings"
},
"options_ui": {
"page": "popup.html"
},
"permissions": ["storage"]
}