'How to convert match patterns in extension manifests to Regular Expression?
In my application manifest I have declared in the content_scripts the matches for valid URLs where the extension should be allowed to run
"content_scripts": [
{
"matches": ["*://*.creoweb.com/data/", "*://*.creoweb.com/cp/*/history/","*://*.creoweb.com/user/*/panel/"],
"js": ["content_scripts/core.js"]
}
]
In my code I have something like this:
const filter = {
url:
[
{urlMatches: "*://*.creoweb.com/data/"},
{urlMatches: "*://*.creoweb.com/cp/*/history/"},
{urlMatches: "*://*.creoweb.com/user/*/panel/"}
]
}
function logOnCompleted(details) {
console.log(`onCompleted: ${details.url}`);
}
browser.webNavigation.onCompleted.addListener(logOnCompleted, filter);
I think that the listener wants RegEx to work, in fact I'm not getting any console log output using this.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
