I have two domains and I need to pass localstorage data from domain A to domain B when execute a botton of the extension that i'm creating?
The easiest way is to use chrome.storage.local
. Content scripts in all tabs can access chrome.storage.local
.
So, content script in Domain A tab:
chrome.storage.local.set({
fromDomainA: window.localStorage.getItem('fromDomainA')
});
In contentScript on Domain B tab:
const fromDomainA = await chrome.storage.local.get('fromDomainA');
console.log(fromDomainA);