I'm migrating from manifest version 2 to version 3 and one of the functions I used to have to access the local storage of the current page was using this script:
chrome.tabs.executeScript({code:'JSON.stringify(localStorage)'},function(result) {});
From the page these are the values I need to access:
What would be the recommendation in order to pull all keys?
I was able to access to the values using this scrip on the popup.js file.
function getLocalStorage(){
return JSON.stringify(localStorage);
}
chrome.scripting.executeScript({
target: { tabId: currentTab}, // you can get the Tab id using chrome.tabs.query({active: true, currentWindow: true}, (tabs) => {});
func: getLocalStorage,
},
(injectionResults) => {
console.log('storage response: '+injectionResults[0].result);
});
Hope this helps.