I have stored some options in my chrome extension. Using localStorage.setItem().
But when I want to use them on a page, it's not working. I know it's because they are totally in different domains, but how can I reach the settings in my chrome extension domain from any other domain (in my page scripts).
Thanks,
You could use the chrome.storage
API.
To save something locally:
chrome.storage.sync.set({"key":"value"});
To retrieve a value:
chrome.storage.sync.get("key",function(res) {
console.log(res[key])
});
If you don't want the storage to sync across the user's account, you can use chrome.storage.local
instead of chrome.storage.sync
Documentation
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With