I am writing a chrome extension and it needs to work on multiple sites.
Is there away I can modify this tabs.query to detect additional urls other than amazon?
It would be better if there was a way to detect website tags like for shopping or video related websites. Im very new to chrome extension programming.
chrome.tabs.query({ url: 'https://www.amazon.com/*', }, (tabs) => {
alert("site detected");
tabs.forEach(tab => {
chrome.tabs.remove(tab.id);
});
});
2
Answers
Just filter them out later. Since you’ll be using MV3, you can do it like this:
You can pass multiple URLs as an array.
See the documentation. It states the following for the
url
property ofqueryInfo
: