Passing the add-on variable between tabs with different domains

I want to create an add-on that will add an alternative to the toolbara (div element with absolute position) on each website.

But when somebody click the close button, div element will be invisible. Only the reopen button will be visible.

When I set localStorage.myDivHidden = ‘true’ I can read a value only for current domain. When I go to other website myDiv var is again ‘false’.

How can I set a “global” variable for my add-on?

Sorry for my english.

Thank you in advance for your help.
Have a nice day! :slight_smile:

Maybe you should use the WebExtensions storage API here.
It would be something like this:

browser.storage.local.set({
    myHiddenDiv: true
}).then(()=>{
    // value has been saved
})

and to read the value:

browser.storage.local.get("myHiddenDiv")
.then((result)=>{
    // value is in result.myHiddenDiv
})
1 Like

Thank you! That’s it! :slight_smile: