red-magazine-81994
10/05/2022, 4:15 AMmatches
and exclude_matches
to avoid the content script from automatically being injected into <all_urls>
2. Created a background script with a call to chrome.scripting.executeScript
on extension click:
import reactRoot from 'url:./react-component';
chrome.action.onClicked.addListener((tab: chrome.tabs.Tab) => {
chrome.scripting.executeScript(
{
target: { tabId: tab.id },
files: [reactRoot.replace(/chrome-extension:\/\/[a-z]*\/([^?]*)\?.*/i, '$1')], // I think executeScript expects a path that is relative to the extension root...
}
)
});
sticky-dress-98131
10/05/2022, 4:15 AM