I have an array of valid URLs for a user.
let validUrls = ["*.example.com", "*.foo.com"]
I want to request permission to run my contentScript.js if the activeTab
is on a domain that is a validUrl.
Without the user accepting permission first, I don't seem to get the active tab URL, so I am in a catch 22.
chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) => {
console.log("Tab Changed: ", changeInfo, tab);
chrome.scripting.executeScript(
{
target: { tabId: tabId },
func: checkPermissions,
args: [tab.url], // Null because no permission is granted yet
},
(result) => {
console.log(result);
}
);
});
I would like only to be requesting the activeTab permission and not the tabs permission.