Goal
Send message from my content script to my background script whenever the tab changes. The message includes text queried from DOM in content script
Heres what I have so far
Contentscript.js
chrome.runtime.sendMessage(null, workspaceName); // heres where I send the name
background.js
and `popUp.js
chrome.runtime.onMessage.addListener((msg, sender, sendResponse) => {
workspaceName = msg;
console.log(`Workpspace: ${msg}`);
});
This only runs on page load/refresh and when extension is open